|
|
@ -22,6 +22,7 @@ import java.sql.Connection; |
|
|
|
import java.sql.PreparedStatement; |
|
|
|
import java.sql.PreparedStatement; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.sql.SQLException; |
|
|
|
import java.util.EnumMap; |
|
|
|
import java.util.EnumMap; |
|
|
|
|
|
|
|
import java.util.EnumSet; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
import java.util.concurrent.ConcurrentHashMap; |
|
|
|
|
|
|
|
|
|
|
|
public enum DbManager { |
|
|
|
public enum DbManager { |
|
|
@ -266,6 +267,35 @@ public enum DbManager { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static <E extends java.lang.Enum<E>> EnumSet<E> parseEnumSet(String mysqlSet, Class<E> enumClass) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Create empty EnumSet of the given class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
EnumSet<E> enumSet = EnumSet.noneOf(enumClass); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Remove the leading and trailing brackets from the MySQL set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mysqlSet = mysqlSet.substring(1, mysqlSet.length() - 1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Split set string and trim each element
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String[] elements = mysqlSet.split(","); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (String element : elements) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
element = element.trim(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Parse the element into an enum and add to set
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
E enumConstant = java.lang.Enum.valueOf(enumClass, element); |
|
|
|
|
|
|
|
enumSet.add(enumConstant); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Return the EnumSet
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return enumSet; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static void printCacheCount(PlayerCharacter pc) { |
|
|
|
public static void printCacheCount(PlayerCharacter pc) { |
|
|
|
ChatManager.chatSystemInfo(pc, "Cache Lists"); |
|
|
|
ChatManager.chatSystemInfo(pc, "Cache Lists"); |
|
|
|
|
|
|
|
|
|
|
@ -324,4 +354,5 @@ public enum DbManager { |
|
|
|
|
|
|
|
|
|
|
|
Logger.info("Database configured with " + connectionCount + " connections"); |
|
|
|
Logger.info("Database configured with " + connectionCount + " connections"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|