mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2025-08-15 02:29:24 +02:00
Added api stuff so you can actually add new skills and made it *mostyl*
work
This commit is contained in:
@@ -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)) {
|
||||
|
Reference in New Issue
Block a user