SteamWar/BauSystem2.0
Archiviert
12
0

Fix CustomCommandListener

Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
yoyosource 2021-08-24 17:10:01 +02:00
Ursprung 2ec444d477
Commit 15ff88fe6f

Datei anzeigen

@ -267,6 +267,15 @@ public class CustomCommandListener implements Listener {
return;
}
MenuCommand menuCommand = new MenuCommand(bookMeta.getPages(), s.substring(6).split(" "));
for (CustomCommand customCommand : playerMap.computeIfAbsent(p, player -> new ArrayList<>())) {
if (!(customCommand instanceof MenuCommand)) {
continue;
}
if (Arrays.equals(((MenuCommand) customCommand).args, menuCommand.args)) {
p.sendMessage("§cCommand '" + (String.join(" ", menuCommand.args)) + "' bereits definiert");
return;
}
}
playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(menuCommand);
if (!save(p)) {
playerMap.get(p).removeIf(customCommand -> customCommand == menuCommand);