|
@@ -8,6 +8,7 @@ import java.sql.SQLException;
|
|
|
import java.sql.Statement;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Collection;
|
|
|
+import java.util.EnumMap;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -55,6 +56,10 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|
|
connectionProperties.put("user", Config.getInstance().getMySQLUserName());
|
|
|
connectionProperties.put("password", Config.getInstance().getMySQLUserPassword());
|
|
|
connectionProperties.put("autoReconnect", "false");
|
|
|
+ connectionProperties.put("cachePrepStmts", "true");
|
|
|
+ connectionProperties.put("prepStmtCacheSize", "64");
|
|
|
+ connectionProperties.put("prepStmtCacheSqlLimit", "2048");
|
|
|
+ connectionProperties.put("useServerPrepStmts", "true");
|
|
|
connectionPool = new ConnectionPool("mcMMO-Pool",
|
|
|
1 /*Minimum of one*/,
|
|
|
Config.getInstance().getMySQLMaxPoolSize() /*max pool size */,
|
|
@@ -415,7 +420,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|
|
}
|
|
|
|
|
|
public Map<SkillType, Integer> readRank(String playerName) {
|
|
|
- Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>();
|
|
|
+ Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class);
|
|
|
|
|
|
ResultSet resultSet = null;
|
|
|
PreparedStatement statement = null;
|
|
@@ -1238,9 +1243,9 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|
|
}
|
|
|
|
|
|
private PlayerProfile loadFromResult(String playerName, ResultSet result) throws SQLException {
|
|
|
- Map<SkillType, Integer> skills = new HashMap<SkillType, Integer>(); // Skill & Level
|
|
|
- Map<SkillType, Float> skillsXp = new HashMap<SkillType, Float>(); // Skill & XP
|
|
|
- Map<AbilityType, Integer> skillsDATS = new HashMap<AbilityType, Integer>(); // Ability & Cooldown
|
|
|
+ Map<SkillType, Integer> skills = new EnumMap<SkillType, Integer>(SkillType.class); // Skill & Level
|
|
|
+ Map<SkillType, Float> skillsXp = new EnumMap<SkillType, Float>(SkillType.class); // Skill & XP
|
|
|
+ Map<AbilityType, Integer> skillsDATS = new EnumMap<AbilityType, Integer>(AbilityType.class); // Ability & Cooldown
|
|
|
MobHealthbarType mobHealthbarType;
|
|
|
UUID uuid;
|
|
|
|
|
@@ -1309,6 +1314,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|
|
}
|
|
|
|
|
|
private void printErrors(SQLException ex) {
|
|
|
+ StackTraceElement element = ex.getStackTrace()[0];
|
|
|
+ mcMMO.p.getLogger().severe("Location: " + element.getMethodName() + " " + element.getLineNumber());
|
|
|
mcMMO.p.getLogger().severe("SQLException: " + ex.getMessage());
|
|
|
mcMMO.p.getLogger().severe("SQLState: " + ex.getSQLState());
|
|
|
mcMMO.p.getLogger().severe("VendorError: " + ex.getErrorCode());
|