mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 23:26:45 +01:00
Fix API issues
This commit is contained in:
parent
e4915407e7
commit
b22482ccda
@ -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);
|
||||
|
@ -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 <world>", 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<Flag<?>, Object> flags = plot.getFlags();
|
||||
Iterator<Entry<Flag<?>, 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;
|
||||
}
|
||||
}
|
@ -1124,12 +1124,12 @@ public class Plot {
|
||||
return this.removeFlag(getFlagContainer().queryLocal(flag));
|
||||
}
|
||||
|
||||
public Collection<PlotFlag<?, ?>> getApplicableFlags(final boolean ignorePluginFlags) {
|
||||
public Collection<PlotFlag<?, ?>> getApplicableFlags(final boolean plotOnly, final boolean ignorePluginFlags) {
|
||||
if (!hasOwner()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
final Map<Class<?>, PlotFlag<?, ?>> flags = new HashMap<>();
|
||||
if (getArea() != null && !getArea().getFlagContainer().getFlagMap().isEmpty()) {
|
||||
if (!plotOnly && getArea() != null && !getArea().getFlagContainer().getFlagMap().isEmpty()) {
|
||||
final Map<Class<?>, PlotFlag<?, ?>> flagMap = getArea().getFlagContainer().getFlagMap();
|
||||
flags.putAll(flagMap);
|
||||
}
|
||||
@ -1147,6 +1147,10 @@ public class Plot {
|
||||
return flagMap.values();
|
||||
}
|
||||
|
||||
public Collection<PlotFlag<?, ?>> getApplicableFlags(final boolean ignorePluginFlags) {
|
||||
return getApplicableFlags(false, ignorePluginFlags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove a flag from this plot
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user