Fix MaterialCommand triggering WorldEditListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful
Dieser Commit ist enthalten in:
Ursprung
1ed10c8c86
Commit
61282c0f84
@ -21,6 +21,7 @@ package de.steamwar.bausystem.features.util;
|
|||||||
|
|
||||||
import de.steamwar.bausystem.BauSystem;
|
import de.steamwar.bausystem.BauSystem;
|
||||||
import de.steamwar.bausystem.SWUtils;
|
import de.steamwar.bausystem.SWUtils;
|
||||||
|
import de.steamwar.bausystem.features.world.WorldEditListener;
|
||||||
import de.steamwar.bausystem.shared.EnumDisplay;
|
import de.steamwar.bausystem.shared.EnumDisplay;
|
||||||
import de.steamwar.command.PreviousArguments;
|
import de.steamwar.command.PreviousArguments;
|
||||||
import de.steamwar.command.SWCommand;
|
import de.steamwar.command.SWCommand;
|
||||||
@ -51,6 +52,7 @@ public class MaterialCommand extends SWCommand implements Listener {
|
|||||||
|
|
||||||
public MaterialCommand() {
|
public MaterialCommand() {
|
||||||
super("material", "baumaterial");
|
super("material", "baumaterial");
|
||||||
|
WorldEditListener.addCommandExclusion("material");
|
||||||
}
|
}
|
||||||
|
|
||||||
private Map<Player, Search> searchMap = new HashMap<>();
|
private Map<Player, Search> searchMap = new HashMap<>();
|
||||||
|
@ -51,7 +51,12 @@ public class WorldEditListener implements Listener {
|
|||||||
commands.add(s);
|
commands.add(s);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void addCommandExclusion(String s) {
|
||||||
|
commandExclusions.add(s);
|
||||||
|
}
|
||||||
|
|
||||||
private static final Set<String> commands = new HashSet<>();
|
private static final Set<String> commands = new HashSet<>();
|
||||||
|
private static final Set<String> commandExclusions = new HashSet<>();
|
||||||
private static final String[] shortcutCommands = {"//1", "//2", "//90", "//-90", "//180", "//p", "//c", "//flopy", "//floppy", "//flopyp", "//floppyp", "//u", "//r"};
|
private static final String[] shortcutCommands = {"//1", "//2", "//90", "//-90", "//180", "//p", "//c", "//flopy", "//floppy", "//flopyp", "//floppyp", "//u", "//r"};
|
||||||
|
|
||||||
public static boolean isWorldEditCommand(String command) {
|
public static boolean isWorldEditCommand(String command) {
|
||||||
@ -61,6 +66,9 @@ public class WorldEditListener implements Listener {
|
|||||||
for (String s : commands) {
|
for (String s : commands) {
|
||||||
if (command.startsWith(s)) return true;
|
if (command.startsWith(s)) return true;
|
||||||
}
|
}
|
||||||
|
for (String s : commandExclusions) {
|
||||||
|
if (command.startsWith(s)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
return FlatteningWrapper.impl.isWorldEditCommand(command);
|
return FlatteningWrapper.impl.isWorldEditCommand(command);
|
||||||
}
|
}
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren