Merge pull request #269 from MinelinkNetwork/keep-flag

Add keep flag for preventing plots from expiring
This commit is contained in:
boy0001 2015-04-14 20:05:20 +10:00
commit 666b3cff3c
2 changed files with 7 additions and 1 deletions

View File

@ -706,7 +706,7 @@ public class PlotSquared {
} }
public static void setupDefaultFlags() { public static void setupDefaultFlags() {
final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit", "redstone"); final List<String> booleanFlags = Arrays.asList("notify-enter", "notify-leave", "item-drop", "invincible", "instabreak", "drop-protection", "forcefield", "titles", "pve", "pvp", "no-worldedit", "redstone", "keep");
final List<String> intervalFlags = Arrays.asList("feed", "heal"); final List<String> intervalFlags = Arrays.asList("feed", "heal");
final List<String> stringFlags = Arrays.asList("greeting", "farewell"); final List<String> stringFlags = Arrays.asList("greeting", "farewell");
final List<String> intFlags = Arrays.asList("mob-cap", "animal-cap", "hostile-cap"); final List<String> intFlags = Arrays.asList("mob-cap", "animal-cap", "hostile-cap");

View File

@ -18,6 +18,8 @@ import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.events.PlotDeleteEvent; 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.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotHandler; import com.intellectualcrafters.plot.object.PlotHandler;
@ -159,6 +161,10 @@ public class ExpireManager {
final HashMap<UUID, Long> remove = new HashMap<>(); final HashMap<UUID, Long> remove = new HashMap<>();
final Set<UUID> keep = new HashSet<>(); final Set<UUID> keep = new HashSet<>();
for (final Plot plot : plots) { for (final Plot plot : plots) {
final Flag keepFlag = FlagManager.getPlotFlag(plot, "keep");
if (keepFlag != null && (Boolean) keepFlag.getValue()) {
continue;
}
final UUID uuid = plot.owner; final UUID uuid = plot.owner;
if ((uuid == null) || remove.containsKey(uuid)) { if ((uuid == null) || remove.containsKey(uuid)) {
Long stamp; Long stamp;