From e7d5aa17bfaa7a6e29d80e409c7801eb2ba2da07 Mon Sep 17 00:00:00 2001 From: TfT_02 Date: Fri, 11 Jul 2014 15:24:34 +0200 Subject: [PATCH] Add hidden options for uuid conversion --- .../java/com/gmail/nossr50/config/HiddenConfig.java | 12 ++++++++++++ src/main/java/com/gmail/nossr50/mcMMO.java | 3 ++- .../runnables/database/UUIDUpdateAsyncTask.java | 2 +- src/main/resources/hidden.yml | 5 +++++ 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/config/HiddenConfig.java b/src/main/java/com/gmail/nossr50/config/HiddenConfig.java index ffb21ca45..95434d357 100644 --- a/src/main/java/com/gmail/nossr50/config/HiddenConfig.java +++ b/src/main/java/com/gmail/nossr50/config/HiddenConfig.java @@ -12,6 +12,8 @@ public class HiddenConfig { private static int conversionRate; private static boolean useEnchantmentBuffs; private static boolean resendChunksAfterBlockAbility; + private static int uuidConvertInterval; + private static int uuidConvertAmount; public HiddenConfig(String fileName) { HiddenConfig.fileName = fileName; @@ -33,6 +35,8 @@ public class HiddenConfig { conversionRate = config.getInt("Options.ConversionRate", 1); useEnchantmentBuffs = config.getBoolean("Options.EnchantmentBuffs", true); resendChunksAfterBlockAbility = config.getBoolean("Options.RefreshChunks", false); + uuidConvertInterval = config.getInt("Options.UUIDConvertInterval", 30); + uuidConvertAmount = config.getInt("Options.UUIDConvertAmount", 5); } } @@ -51,4 +55,12 @@ public class HiddenConfig { public boolean resendChunksAfterBlockAbility() { return resendChunksAfterBlockAbility; } + + public int getUUIDConvertInterval() { + return uuidConvertInterval; + } + + public int getUUIDConvertAmount() { + return uuidConvertAmount; + } } diff --git a/src/main/java/com/gmail/nossr50/mcMMO.java b/src/main/java/com/gmail/nossr50/mcMMO.java index e726e475d..a46511b4a 100644 --- a/src/main/java/com/gmail/nossr50/mcMMO.java +++ b/src/main/java/com/gmail/nossr50/mcMMO.java @@ -460,7 +460,8 @@ public class mcMMO extends JavaPlugin { new SaveTimerTask().runTaskTimer(this, saveIntervalTicks, saveIntervalTicks); // Slowly update every entry in the database with UUIDs - new UUIDUpdateAsyncTask(this).runTaskTimerAsynchronously(this, 5 * Misc.TICK_CONVERSION_FACTOR, 30 * Misc.TICK_CONVERSION_FACTOR); + int uuidConvertInterval = HiddenConfig.getInstance().getUUIDConvertInterval(); + new UUIDUpdateAsyncTask(this).runTaskTimerAsynchronously(this, uuidConvertInterval * Misc.TICK_CONVERSION_FACTOR, uuidConvertInterval * Misc.TICK_CONVERSION_FACTOR); // Cleanup the backups folder new CleanBackupsTask().runTaskAsynchronously(mcMMO.p); diff --git a/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java b/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java index ac89ecd53..264e00b47 100644 --- a/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/database/UUIDUpdateAsyncTask.java @@ -12,7 +12,7 @@ import com.gmail.nossr50.util.Misc; public class UUIDUpdateAsyncTask extends BukkitRunnable { private mcMMO plugin; - private static final int MAX_LOOKUP = 5; + private static final int MAX_LOOKUP = HiddenConfig.getInstance().getUUIDConvertAmount(); private DatabaseManager databaseManager; private List userNames; diff --git a/src/main/resources/hidden.yml b/src/main/resources/hidden.yml index cf0894914..abc7a5ba9 100644 --- a/src/main/resources/hidden.yml +++ b/src/main/resources/hidden.yml @@ -11,3 +11,8 @@ Options: EnchantmentBuffs: true # true to enable refreshing of chunks around a player at the end of Super Breaker, Giga Drill Breaker, and Berserk. This should fix blocks being broken client side, but not server-side RefreshChunks: false + + # The interval at which the server updates a couple of users to get their UUID, in seconds + UUIDConvertInterval: 30 + # Amount of users to convert every interval + UUIDConvertAmount: 5