Added ignore-if-modified

This commit is contained in:
boy0001 2015-06-16 02:47:56 +10:00
parent 14ce682a63
commit ab03b358f5
3 changed files with 15 additions and 6 deletions

View File

@ -832,6 +832,7 @@ public class PlotSquared {
options.put("clear.fastmode", Settings.ENABLE_CLUSTERS); options.put("clear.fastmode", Settings.ENABLE_CLUSTERS);
options.put("clear.auto.clear-interval-seconds", Settings.CLEAR_INTERVAL); options.put("clear.auto.clear-interval-seconds", Settings.CLEAR_INTERVAL);
options.put("clear.keep-if-modified", Settings.MIN_BLOCKS_CHANGED); options.put("clear.keep-if-modified", Settings.MIN_BLOCKS_CHANGED);
options.put("clear.ignore-if-modified", Settings.MIN_BLOCKS_CHANGED_IGNORED);
// Schematics // Schematics
options.put("schematics.save_path", Settings.SCHEMATIC_SAVE_PATH); 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.AUTO_CLEAR = config.getBoolean("clear.auto.enabled");
Settings.CLEAR_INTERVAL = config.getInt("clear.auto.clear-interval-seconds"); Settings.CLEAR_INTERVAL = config.getInt("clear.auto.clear-interval-seconds");
Settings.MIN_BLOCKS_CHANGED = config.getInt("clear.keep-if-modified"); Settings.MIN_BLOCKS_CHANGED = config.getInt("clear.keep-if-modified");
Settings.MIN_BLOCKS_CHANGED_IGNORED = config.getInt("clear.ignore-if-modified");
// Schematics // Schematics
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");

View File

@ -147,6 +147,7 @@ public class Settings {
public static int AUTO_CLEAR_DAYS = 360; public static int AUTO_CLEAR_DAYS = 360;
public static boolean AUTO_CLEAR_CHECK_DISK = false; public static boolean AUTO_CLEAR_CHECK_DISK = false;
public static int MIN_BLOCKS_CHANGED = -1; public static int MIN_BLOCKS_CHANGED = -1;
public static int MIN_BLOCKS_CHANGED_IGNORED = -1;
public static int CLEAR_INTERVAL = 120; public static int CLEAR_INTERVAL = 120;
/** /**
* API Location * API Location

View File

@ -126,12 +126,18 @@ public class ExpireManager {
@Override @Override
public void run() { public void run() {
int changed = (int) this.value; int changed = (int) this.value;
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) { if (changed >= Settings.MIN_BLOCKS_CHANGED && Settings.MIN_BLOCKS_CHANGED > 0) {
PlotSquared.log("&aKeep flag added to: " + plot.id + (changed != -1 ? " (changed " + value + ")" : "")); PlotSquared.log("&aKeep flag added to: " + plot.id + (changed != -1 ? " (changed " + value + ")" : ""));
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("keep"), true)); FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("keep"), true));
expiredPlots.get(world).remove(plot); expiredPlots.get(world).remove(plot);
return; 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); manager.clearPlot(plotworld, plot, false, null);
MainUtil.removeSign(plot); MainUtil.removeSign(plot);
DBFunc.delete(world, plot); DBFunc.delete(world, 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); HybridUtils.manager.checkModified(plot, run);
} }
else { else {