From ab03b358f54938eeb6a1e276a8808285463d349f Mon Sep 17 00:00:00 2001 From: boy0001 Date: Tue, 16 Jun 2015 02:47:56 +1000 Subject: [PATCH] Added ignore-if-modified --- .../intellectualcrafters/plot/PlotSquared.java | 2 ++ .../plot/config/Settings.java | 1 + .../plot/util/ExpireManager.java | 18 ++++++++++++------ 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index 0438a6d06..9aa96c146 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -832,6 +832,7 @@ public class PlotSquared { options.put("clear.fastmode", Settings.ENABLE_CLUSTERS); options.put("clear.auto.clear-interval-seconds", Settings.CLEAR_INTERVAL); options.put("clear.keep-if-modified", Settings.MIN_BLOCKS_CHANGED); + options.put("clear.ignore-if-modified", Settings.MIN_BLOCKS_CHANGED_IGNORED); // Schematics options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH); @@ -913,6 +914,7 @@ public class PlotSquared { Settings.AUTO_CLEAR = config.getBoolean("clear.auto.enabled"); Settings.CLEAR_INTERVAL = config.getInt("clear.auto.clear-interval-seconds"); Settings.MIN_BLOCKS_CHANGED = config.getInt("clear.keep-if-modified"); + Settings.MIN_BLOCKS_CHANGED_IGNORED = config.getInt("clear.ignore-if-modified"); // Schematics Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java index ed2a63844..26235dd1a 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/config/Settings.java @@ -147,6 +147,7 @@ public class Settings { public static int AUTO_CLEAR_DAYS = 360; public static boolean AUTO_CLEAR_CHECK_DISK = false; public static int MIN_BLOCKS_CHANGED = -1; + public static int MIN_BLOCKS_CHANGED_IGNORED = -1; public static int CLEAR_INTERVAL = 120; /** * API Location 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 fd5728c54..c3677f6cc 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -126,11 +126,17 @@ public class ExpireManager { @Override public void run() { int changed = (int) this.value; - if (changed >= Settings.MIN_BLOCKS_CHANGED && Settings.MIN_BLOCKS_CHANGED > 0) { - PlotSquared.log("&aKeep flag added to: " + plot.id + (changed != -1 ? " (changed " + value + ")" : "")); - FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("keep"), true)); - expiredPlots.get(world).remove(plot); - return; + if (Settings.MIN_BLOCKS_CHANGED_IGNORED > 0 || Settings.MIN_BLOCKS_CHANGED > 0 && manager instanceof ClassicPlotManager) { + if (changed >= Settings.MIN_BLOCKS_CHANGED && Settings.MIN_BLOCKS_CHANGED > 0) { + PlotSquared.log("&aKeep flag added to: " + plot.id + (changed != -1 ? " (changed " + value + ")" : "")); + FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("keep"), true)); + expiredPlots.get(world).remove(plot); + return; + } + else if (changed >= Settings.MIN_BLOCKS_CHANGED_IGNORED && Settings.MIN_BLOCKS_CHANGED_IGNORED > 0) { + expiredPlots.get(world).remove(plot); + return; + } } manager.clearPlot(plotworld, plot, false, null); MainUtil.removeSign(plot); @@ -146,7 +152,7 @@ public class ExpireManager { } } }; - if (Settings.MIN_BLOCKS_CHANGED > 0 && manager instanceof ClassicPlotManager) { + if (Settings.MIN_BLOCKS_CHANGED_IGNORED > 0 || Settings.MIN_BLOCKS_CHANGED > 0 && manager instanceof ClassicPlotManager) { HybridUtils.manager.checkModified(plot, run); } else {