diff --git a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java index f9606d7d..09546146 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/HotbarService.java @@ -110,10 +110,11 @@ public void load() { byte slot = (byte) config.getInt(path + "SLOT"); List lore = config.getStringList(path + "LORE"); String command = config.getString(path + "COMMAND"); + List commands = config.getStringList(path + "COMMANDS"); ProfileState profileState = ProfileState.valueOf(config.getString(path + "STATE")); int customModelData = config.getInt(path + "CUSTOM_MODEL_DATA", 0); - - CustomItem customItem = new CustomItem(displayName, material, lore, slot, command, customModelData); + if (command != null && !command.isEmpty() && !commands.contains(command)) commands.add(command); + CustomItem customItem = new CustomItem(displayName, material, lore, slot, commands, customModelData); items.get(profileState).addItem(customItem, slot); } } diff --git a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/impl/CustomItem.java b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/impl/CustomItem.java index e3631d1b..4cb8d761 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/impl/CustomItem.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/impl/CustomItem.java @@ -6,10 +6,10 @@ @Getter public class CustomItem extends Item { - private final String command; + private final List commands; - public CustomItem(String displayName, String material, List lore, byte slot, String command, int customModelData) { + public CustomItem(String displayName, String material, List lore, byte slot, List commands, int customModelData) { super(null, displayName, material, lore, true, slot, customModelData); - this.command = command; + this.commands = commands; } } diff --git a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/listener/ItemListener.java b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/listener/ItemListener.java index c94cce0c..84a46912 100644 --- a/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/listener/ItemListener.java +++ b/Plugin/src/main/java/dev/lrxh/neptune/feature/hotbar/listener/ItemListener.java @@ -21,6 +21,8 @@ import org.bukkit.event.player.PlayerSwapHandItemsEvent; import org.bukkit.inventory.ItemStack; +import java.util.List; + public class ItemListener implements Listener { @EventHandler @@ -113,9 +115,11 @@ private void handleAction(Profile profile, ItemStack item) { return; if (clickedItem instanceof CustomItem customItem) { - String command = customItem.getCommand(); - if (!command.equalsIgnoreCase("none")) { - profile.getPlayer().performCommand(customItem.getCommand()); + List commands = customItem.getCommands(); + for (String command : commands) { + if (!command.equalsIgnoreCase("none")) { + profile.getPlayer().performCommand(command); + } } } else { clickedItem.getAction().execute(profile.getPlayer()); diff --git a/docs/placeholders.md b/docs/placeholders.md index 9c8e9c21..b10ac0e6 100644 --- a/docs/placeholders.md +++ b/docs/placeholders.md @@ -33,7 +33,7 @@ May not be up-to-date. | Plugin | PlaceholderAPI | Description | |-----------------|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------| | \ | %neptune_kit_name% | The display name of the kit the player is playing on | -| \ | %neptune_kit_division% | The division | | \ | %neptune_max_ping% | The maximum ping allowed by the player in their settings | | \