Fix CustomCommandListener
Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
2ec444d477
Commit
15ff88fe6f
@ -267,6 +267,15 @@ public class CustomCommandListener implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
MenuCommand menuCommand = new MenuCommand(bookMeta.getPages(), s.substring(6).split(" "));
|
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);
|
playerMap.computeIfAbsent(p, player -> new ArrayList<>()).add(menuCommand);
|
||||||
if (!save(p)) {
|
if (!save(p)) {
|
||||||
playerMap.get(p).removeIf(customCommand -> customCommand == menuCommand);
|
playerMap.get(p).removeIf(customCommand -> customCommand == menuCommand);
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren