SteamWar/BauSystem2.0
Archiviert
12
0

Fix MaterialCommand triggering WorldEditListener
Alle Prüfungen waren erfolgreich
SteamWarCI Build successful

Dieser Commit ist enthalten in:
yoyosource 2023-12-03 15:19:19 +01:00
Ursprung 1ed10c8c86
Commit 61282c0f84
2 geänderte Dateien mit 10 neuen und 0 gelöschten Zeilen

Datei anzeigen

@ -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<>();

Datei anzeigen

@ -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);
} }