From 21e9c50ecd56d3d2ef5e551dc25115bcf0ec09c6 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Tue, 1 Feb 2022 09:41:29 +0100 Subject: [PATCH] Update ScriptCommand menu creation with lore of items. Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 2 ++ .../features/script/ScriptCommand.java | 23 ++++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index 2ba75329..22268ea5 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -438,6 +438,8 @@ SCRIPT_GUI_CUSTOM_EVENTS_LORE_14 = §7 hasBlock §8[§7blockX, blockY, blockZ SCRIPT_GUI_CUSTOM_EVENTS_LORE_15 = §eTNTSpawn SCRIPT_GUI_CUSTOM_EVENTS_LORE_16 = §eTNTExplode §8-§7 x, y, z SCRIPT_GUI_CUSTOM_EVENTS_LORE_17 = §eTNTExplodeInBuild §8-§7 x, y, z +SCRIPT_GUI_CUSTOM_EVENTS_LORE_18 = §eSelfJoin §8-§7 x, y, z, playerName +SCRIPT_GUI_CUSTOM_EVENTS_LORE_19 = §eSelfLeave §8-§7 x, y, z, playerName SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_1 = §e* §8-§7 Alles in den Klammern ist nur gesetzt, SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_2 = §7wenn die Variable dafür gesetzt ist. diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java index 581b07e0..e185ff3d 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java @@ -29,6 +29,23 @@ public class ScriptCommand extends SWCommand { private static List> swItems = new ArrayList<>(); + private List loreBuilder(Player p, String prefix, int start, int end) { + List lore = new ArrayList<>(); + for (int i = start; i <= end; i++) { + lore.add(BauSystem.MESSAGE.parse(prefix + i, p)); + } + return lore; + } + + private List loreBuilder(Player p, String prefix, int start, int end, List append) { + List lore = new ArrayList<>(); + for (int i = start; i <= end; i++) { + lore.add(BauSystem.MESSAGE.parse(prefix + i, p)); + } + lore.addAll(append); + return lore; + } + @Register(description = "SCRIPT_COMMAND_HELP") public void menuCommand(Player p) { if (swItems.isEmpty()) { @@ -36,11 +53,11 @@ public class ScriptCommand extends SWCommand { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> { }), null)); } - swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_1", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_2", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_3", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_4", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_5", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_6", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_7", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_8", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_9", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_10", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_11", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_12", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS_LORE_13", p)), false, clickType -> { + swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_COMMANDS", p), loreBuilder(p, "SCRIPT_GUI_CUSTOM_COMMANDS_LORE_", 1, 13), false, clickType -> { }), null)); - swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_1", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_2", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_3", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_4", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_5", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_6", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_7", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_8", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_9", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_10", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_11", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_12", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_13", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_14", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_15", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_16", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_17", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_1", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_2", p)), false, clickType -> { + swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, BauSystem.MESSAGE.parse("SCRIPT_GUI_CUSTOM_EVENTS", p), loreBuilder(p, "SCRIPT_GUI_CUSTOM_EVENTS_LORE_", 1, 19, loreBuilder(p, "SCRIPT_GUI_CUSTOM_EVENTS_LORE_STAR_", 1, 2)), false, clickType -> { }), null)); - swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_1", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_2", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_3", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_4", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_5", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_6", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_7", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_8", p), BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER_LORE_9", p)), false, clickType -> { + swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.BOOK, BauSystem.MESSAGE.parse("SCRIPT_GUI_OTHER", p), loreBuilder(p, "SCRIPT_GUI_OTHER_LORE_", 1, 9), false, clickType -> { }), null)); for (int i = 0; i < 3; i++) { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> {