diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java index 236b24329..2e57da6e3 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugExec.java @@ -6,7 +6,6 @@ import com.github.intellectualsites.plotsquared.plot.PlotSquared; import com.github.intellectualsites.plotsquared.plot.config.Captions; import com.github.intellectualsites.plotsquared.plot.config.Settings; import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.flag.FlagManager; import com.github.intellectualsites.plotsquared.plot.flags.GlobalFlagContainer; import com.github.intellectualsites.plotsquared.plot.flags.PlotFlag; import com.github.intellectualsites.plotsquared.plot.generator.HybridUtils; @@ -120,7 +119,6 @@ import java.util.concurrent.CompletableFuture; this.scope.put("Settings", new Settings()); this.scope.put("StringMan", new StringMan()); this.scope.put("MathMan", new MathMan()); - this.scope.put("FlagManager", new FlagManager()); // Classes this.scope.put("Location", Location.class); diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java deleted file mode 100644 index 64f42752f..000000000 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/commands/DebugFixFlags.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.github.intellectualsites.plotsquared.plot.commands; - -import com.github.intellectualsites.plotsquared.commands.Argument; -import com.github.intellectualsites.plotsquared.commands.CommandDeclaration; -import com.github.intellectualsites.plotsquared.plot.PlotSquared; -import com.github.intellectualsites.plotsquared.plot.config.Captions; -import com.github.intellectualsites.plotsquared.plot.database.DBFunc; -import com.github.intellectualsites.plotsquared.plot.flag.Flag; -import com.github.intellectualsites.plotsquared.plot.object.Plot; -import com.github.intellectualsites.plotsquared.plot.object.PlotArea; -import com.github.intellectualsites.plotsquared.plot.object.PlotPlayer; -import com.github.intellectualsites.plotsquared.plot.util.MainUtil; -import com.github.intellectualsites.plotsquared.plot.util.WorldUtil; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map.Entry; - -@CommandDeclaration(command = "debugfixflags", usage = "/plot debugfixflags ", permission = "plots.debugfixflags", description = "Attempt to fix all flags for a world", requiredType = RequiredType.CONSOLE, category = CommandCategory.DEBUG) -public class DebugFixFlags extends SubCommand { - - public DebugFixFlags() { - super(Argument.String); - } - - @Override public boolean onCommand(PlotPlayer player, String[] args) { - PlotArea area = PlotSquared.get().getPlotAreaByString(args[0]); - if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) { - MainUtil.sendMessage(player, Captions.NOT_VALID_PLOT_WORLD, args[0]); - return false; - } - MainUtil.sendMessage(player, "&8--- &6Starting task &8 ---"); - for (Plot plot : area.getPlots()) { - HashMap, Object> flags = plot.getFlags(); - Iterator, Object>> i = flags.entrySet().iterator(); - boolean changed = false; - while (i.hasNext()) { - if (i.next().getKey() == null) { - changed = true; - i.remove(); - } - } - if (changed) { - DBFunc.setFlags(plot, plot.getFlags()); - } - } - MainUtil.sendMessage(player, "&aDone!"); - return true; - } -} diff --git a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java index 20d0af40e..b7aa94329 100644 --- a/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java +++ b/Core/src/main/java/com/github/intellectualsites/plotsquared/plot/object/Plot.java @@ -1124,12 +1124,12 @@ public class Plot { return this.removeFlag(getFlagContainer().queryLocal(flag)); } - public Collection> getApplicableFlags(final boolean ignorePluginFlags) { + public Collection> getApplicableFlags(final boolean plotOnly, final boolean ignorePluginFlags) { if (!hasOwner()) { return Collections.emptyList(); } final Map, PlotFlag> flags = new HashMap<>(); - if (getArea() != null && !getArea().getFlagContainer().getFlagMap().isEmpty()) { + if (!plotOnly && getArea() != null && !getArea().getFlagContainer().getFlagMap().isEmpty()) { final Map, PlotFlag> flagMap = getArea().getFlagContainer().getFlagMap(); flags.putAll(flagMap); } @@ -1147,6 +1147,10 @@ public class Plot { return flagMap.values(); } + public Collection> getApplicableFlags(final boolean ignorePluginFlags) { + return getApplicableFlags(false, ignorePluginFlags); + } + /** * Remove a flag from this plot *