Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,11 @@ public void load() {
byte slot = (byte) config.getInt(path + "SLOT");
List<String> lore = config.getStringList(path + "LORE");
String command = config.getString(path + "COMMAND");
List<String> 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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

@Getter
public class CustomItem extends Item {
private final String command;
private final List<String> commands;

public CustomItem(String displayName, String material, List<String> lore, byte slot, String command, int customModelData) {
public CustomItem(String displayName, String material, List<String> lore, byte slot, List<String> commands, int customModelData) {
super(null, displayName, material, lore, true, slot, customModelData);
this.command = command;
this.commands = commands;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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<String> commands = customItem.getCommands();
for (String command : commands) {
if (!command.equalsIgnoreCase("none")) {
profile.getPlayer().performCommand(command);
}
}
} else {
clickedItem.getAction().execute(profile.getPlayer());
Expand Down
2 changes: 1 addition & 1 deletion docs/placeholders.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ May not be up-to-date.
| Plugin | PlaceholderAPI | Description |
|-----------------|---------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| \<kit> | %neptune_kit_name% | The display name of the kit the player is playing on |
| \<kit-division | %neptune_kit_division% | The division |
| \<kit-division> | %neptune_kit_division% | The division |
| \<max-ping> | %neptune_max_ping% | The maximum ping allowed by the player in their settings |
| \<time> | %neptune_time% | The time in minutes and seconds that the player has been queueing for |
| None | %neptune_kit_(name/elo/division/rounds/current_win_streak/best_win_streak/wins/losses/kills/deaths/queued/in_match) | Kit-specific stats |
Expand Down