More console spam reduction for database operations

This commit is contained in:
nossr50 2021-03-12 16:37:21 -08:00
parent 4a048b47cb
commit 75db0af01d
4 changed files with 4 additions and 7 deletions

View File

@ -1,4 +1,5 @@
Version 2.1.181 Version 2.1.181
mcMMO no longer pointlessly tries to check for missing UUIDs for FlatFile database
Removed the "name change detected" message as some plugins (such as Plan) invoke API calls which spams the console with this message Removed the "name change detected" message as some plugins (such as Plan) invoke API calls which spams the console with this message
Refactored code related to loading player data from the database Refactored code related to loading player data from the database
(API) Added DatabaseManager::loadPlayerProfile(String) (API) Added DatabaseManager::loadPlayerProfile(String)

View File

@ -78,10 +78,6 @@ public final class FlatFileDatabaseManager implements DatabaseManager {
usersFile = new File(mcMMO.getUsersFilePath()); usersFile = new File(mcMMO.getUsersFilePath());
checkStructure(); checkStructure();
updateLeaderboards(); updateLeaderboards();
if (mcMMO.getUpgradeManager().shouldUpgrade(UpgradeType.ADD_UUIDS)) {
new UUIDUpdateAsyncTask(mcMMO.p, getStoredUsers()).start();
}
} }
public void purgePowerlessUsers() { public void purgePowerlessUsers() {

View File

@ -1337,6 +1337,8 @@ public final class SQLDatabaseManager implements DatabaseManager {
mcMMO.p.getLogger().info("Adding UUIDs to mcMMO MySQL user table..."); mcMMO.p.getLogger().info("Adding UUIDs to mcMMO MySQL user table...");
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL"); statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD `uuid` varchar(36) NULL DEFAULT NULL");
statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE"); statement.executeUpdate("ALTER TABLE `" + tablePrefix + "users` ADD UNIQUE INDEX `uuid` (`uuid`) USING BTREE");
new GetUUIDUpdatesRequired().runTaskLaterAsynchronously(mcMMO.p, 100); // wait until after first purge
} }
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS); mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
@ -1347,8 +1349,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
finally { finally {
tryClose(resultSet); tryClose(resultSet);
} }
new GetUUIDUpdatesRequired().runTaskLaterAsynchronously(mcMMO.p, 100); // wait until after first purge
} }
private class GetUUIDUpdatesRequired extends BukkitRunnable { private class GetUUIDUpdatesRequired extends BukkitRunnable {

View File

@ -99,7 +99,7 @@ public class UUIDUpdateAsyncTask implements Runnable {
position += batch.size(); position += batch.size();
plugin.getLogger().info(String.format("Conversion progress: %d/%d users", position, userNames.size())); plugin.getLogger().info(String.format("Conversion progress: %d/%d users", position, userNames.size()));
if (position == userNames.size()) { if (position +1 >= userNames.size()) {
mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS); mcMMO.getUpgradeManager().setUpgradeCompleted(UpgradeType.ADD_UUIDS);
awaiter.countDown(); awaiter.countDown();
plugin.getLogger().info("UUID checks completed"); plugin.getLogger().info("UUID checks completed");