diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomCommandListener.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomCommandListener.java index 31601335..2eb7947e 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomCommandListener.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/CustomCommandListener.java @@ -181,17 +181,22 @@ public class CustomCommandListener implements Listener { playerMap.remove(e.getPlayer()); } - private boolean save(Player p) { - if (!playerMap.containsKey(p)) { - UserConfig.removePlayerConfig(p.getUniqueId(), "bausystem-commands"); - return true; - } + private YAPIONObject output(Player p) { YAPIONObject yapionObject = new YAPIONObject(); YAPIONMap yapionMap = new YAPIONMap(); yapionObject.add("", yapionMap); playerMap.get(p).stream().filter(MenuCommand.class::isInstance).map(MenuCommand.class::cast).forEach(menuCommand -> { menuCommand.toYAPION(yapionMap); }); + return yapionObject; + } + + private boolean save(Player p) { + if (!playerMap.containsKey(p)) { + UserConfig.removePlayerConfig(p.getUniqueId(), "bausystem-commands"); + return true; + } + YAPIONObject yapionObject = output(p); if (yapionObject.toYAPION(new LengthOutput()).getLength() > 64 * 1024) { return false; } @@ -238,7 +243,17 @@ public class CustomCommandListener implements Listener { menuCommands.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, command, Arrays.asList("§7Klicke zum rausnehmen", "§7Middle Klicke zum kopieren"), false, clickType -> { }), menuCommand)); }); - SWListInv menuCommandSWListInv = new SWListInv<>(p, "§eScript Commands", false, menuCommands, (clickType, menuCommand) -> { + int length = (int) output(p).toYAPION(new LengthOutput()).getLength(); + StringBuilder menuName = new StringBuilder(); + menuName.append("§eScript Commands"); + if (length > 58982) { + if (length == 655336) { + menuName.append(" §8(§cVoll§8)"); + } else { + menuName.append(" §8(§6Fast Voll§8)"); + } + } + SWListInv menuCommandSWListInv = new SWListInv<>(p, menuName.toString(), false, menuCommands, (clickType, menuCommand) -> { if (!clickType.isCreativeAction()) { playerMap.get(p).removeIf(customCommand -> customCommand == menuCommand); }