From de9511b0b7ca36186ff0646e831bbcf24896509e Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 20 Jan 2022 20:30:29 +0100 Subject: [PATCH] Add 2 new Constants Signed-off-by: yoyosource --- BauSystem_Main/src/BauSystem.properties | 6 ++++++ .../steamwar/bausystem/features/script/ScriptCommand.java | 6 +++++- .../bausystem/features/script/variables/Constants.java | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/BauSystem_Main/src/BauSystem.properties b/BauSystem_Main/src/BauSystem.properties index be1713d7..20bb00ff 100644 --- a/BauSystem_Main/src/BauSystem.properties +++ b/BauSystem_Main/src/BauSystem.properties @@ -509,6 +509,12 @@ SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_LORE = §eMaterial§7 des Items im Slot SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_NAME = §7Constant §eoffhandmaterial SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_LORE = §eMaterial§7 des Items in der Off Hand +SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_NAME = §7Constant §ematerialname +SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_LORE = §eName§7 des Items im Slot + +SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_NAME = §7Constant §eoffmaterialname +SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_LORE = §eName§7 des Items in der Off Hand + SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME = §7Constant §eregion-type SCRIPT_GUI_CONSTANT_REGION_TYPE_LORE = §eRegionstype§7 der jetztigen Region 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 4785e107..4959df43 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/ScriptCommand.java @@ -122,9 +122,13 @@ public class ScriptCommand extends SWCommand { }), null)); swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.IRON_BLOCK, BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_LORE", p)), false, clickType -> { }), null)); + swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.NAME_TAG, BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_SLOT_MATERIAL_DISPLAY_LORE", p)), false, clickType -> { + }), null)); + swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.ACACIA_SIGN, BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_OFF_HAND_MATERIAL_DISPLAY_LORE", p)), false, clickType -> { + }), null)); swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.MAP, BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_REGION_TYPE_NAME", p), Arrays.asList(BauSystem.MESSAGE.parse("SCRIPT_GUI_CONSTANT_REGION_TYPE_LORE", p)), false, clickType -> { }), null)); - for (int i = 0; i < 2 * 9; i++) { + for (int i = 0; i < 2 * 9 - 2; i++) { swItems.add(new SWListInv.SWListEntry<>(new SWItem(Material.GRAY_STAINED_GLASS_PANE, "§7", new ArrayList<>(), false, clickType -> { }), null)); } diff --git a/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java b/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java index 1bced425..bda3bf50 100644 --- a/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java +++ b/BauSystem_Main/src/de/steamwar/bausystem/features/script/variables/Constants.java @@ -280,6 +280,12 @@ public class Constants { CONSTANTS.put("offhandmaterial", player -> { return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getType().name()); }); + CONSTANTS.put("materialname", player -> { + return new ConstantStringValue(() -> player.getInventory().getItemInMainHand().getItemMeta().getDisplayName()); + }); + CONSTANTS.put("offmaterialname", player -> { + return new ConstantStringValue(() -> player.getInventory().getItemInOffHand().getItemMeta().getDisplayName()); + }); CONSTANTS.put("region-type", player -> { Region region = Region.getRegion(player.getLocation()); if (region.isGlobal()) {