Added api stuff so you can actually add new skills and made it *mostyl*

work
This commit is contained in:
ile123ile
2014-08-30 20:26:21 -07:00
parent d47a51b91d
commit cf01241e2d
6 changed files with 99 additions and 23 deletions

View File

@@ -595,6 +595,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
// There is such a user
writeMissingRows(connection, id);
addNewSkills(connection);
statement = connection.prepareStatement(
"SELECT "
+ com.gmail.nossr50.util.StringUtils.createStringFromList(SkillType.getLowerSkillNames(), "s.", ", ")
@@ -1470,6 +1472,37 @@ public final class SQLDatabaseManager implements DatabaseManager {
}
}
}
private void addNewSkills(Connection connection) {
Statement statement = null;
try {
statement = connection.createStatement();
for (String skill : SkillType.getLowerSkillNames()) {
try {
statement.executeQuery("SELECT `" + skill + "` FROM `" + tablePrefix + "skills` LIMIT 1");
}
catch (SQLException ex) {
mcMMO.p.getLogger().info("Updating mcMMO MySQL tables for Fishing...");
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "skills` ADD `" + skill + "` int(10) NOT NULL DEFAULT '0'");
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "experience` ADD `" + skill + "` int(10) NOT NULL DEFAULT '0'");
}
}
}
catch (SQLException ex) {
printErrors(ex);
}
finally {
if (statement != null) {
try {
statement.close();
}
catch (SQLException e) {
// Ignore
}
}
}
}
private int getUserID(final Connection connection, final String playerName, final UUID uuid) {
if (cachedUserIDs.containsKey(uuid)) {