From c0acc4310c8012fb21da56b39f448a03e7e391ef Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 23 Jan 2015 11:02:04 -0700 Subject: [PATCH] Added debug command to start/stop task --- .../intellectualcrafters/plot/PlotMain.java | 2 +- .../plot/util/ExpireManager.java | 20 ++++++++++--------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java index ed4e099b3..7deda77a4 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotMain.java @@ -862,7 +862,7 @@ public class PlotMain extends JavaPlugin implements Listener { Settings.MAX_PLOTS = config.getInt("max_plots"); Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); - Settings.OFFLINE_MODE = config.getBoolean("uuid.offline"); + Settings.OFFLINE_MODE = config.getBoolean("UUID.offline"); Settings.UUID_FROM_DISK = config.getBoolean("uuid.read-from-disk"); Settings.REQUIRE_SELECTION = config.getBoolean("worldedit.require-selection-in-mask"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java index 47bca3498..702220d2f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -112,15 +112,17 @@ public class ExpireManager { } public static boolean isExpired(UUID uuid) { - OfflinePlayer op = UUIDHandler.uuidWrapper.getOfflinePlayer(uuid); - if (!op.hasPlayedBefore()) { - return true; - } - long last = op.getLastPlayed(); - long compared = System.currentTimeMillis() - last; - if (compared >= 86400000 * Settings.AUTO_CLEAR_DAYS) { - return true; - } + String name = UUIDHandler.getName(uuid); + if (name != null) { + OfflinePlayer op = Bukkit.getOfflinePlayer(name); + if (op.hasPlayedBefore()) { + long last = op.getLastPlayed(); + long compared = System.currentTimeMillis() - last; + if (compared >= 86400000 * Settings.AUTO_CLEAR_DAYS) { + return true; + } + } + } return false; }