From c8498fdb213f03bd8651398286b0f771733d1e1e Mon Sep 17 00:00:00 2001 From: Byteflux Date: Tue, 14 Apr 2015 02:32:19 -0700 Subject: [PATCH] Add keep flag for preventing plots from expiring. Closes #259 --- .../java/com/intellectualcrafters/plot/PlotSquared.java | 2 +- .../com/intellectualcrafters/plot/util/ExpireManager.java | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java index 9b67552ed..78296a479 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/PlotSquared.java @@ -706,7 +706,7 @@ public class PlotSquared { } public static void setupDefaultFlags() { - final List booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit", "redstone"); + final List booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit", "redstone", "keep"); final List intervalFlags = Arrays.asList("feed", "heal"); final List stringFlags = Arrays.asList("greeting", "farewell"); final List intFlags = Arrays.asList("mob-cap", "animal-cap", "hostile-cap"); 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 a408587d3..ab83c26b2 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java @@ -18,6 +18,8 @@ import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.events.PlotDeleteEvent; +import com.intellectualcrafters.plot.flag.Flag; +import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.object.OfflinePlotPlayer; import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.PlotHandler; @@ -159,6 +161,10 @@ public class ExpireManager { final HashMap remove = new HashMap<>(); final Set keep = new HashSet<>(); for (final Plot plot : plots) { + final Flag keepFlag = FlagManager.getPlotFlag(plot, "keep"); + if (keepFlag != null && (Boolean) keepFlag.getValue()) { + continue; + } final UUID uuid = plot.owner; if ((uuid == null) || remove.containsKey(uuid)) { Long stamp;