any action added

This commit is contained in:
rockyhawk64 2025-07-13 22:02:08 +10:00
parent b3df124029
commit 0bfadce2f1
5 changed files with 11 additions and 10 deletions

View File

@ -1 +0,0 @@
CommandPanels

View File

@ -26,15 +26,13 @@ items: # These are the components, separated from the order for flexibility and
actions:
commands:
- '[msg] &dColour Works'
icon:
type: PATH #Some resource pack paths can be used for icons
texture: 'textures/items/redstone_dust.png'
icon-type: PATH #Some resource pack paths can be used for icons
icon-texture: 'textures/items/redstone_dust.png'
example_button2:
name: 'Click me to display a message'
actions:
commands:
- '[msg] &dColour Works'
icon:
type: URL #URLs can be used for icons
texture: 'https://example.com/image.jpg'
icon-type: URL #URLs can be used for icons
icon-texture: 'https://example.com/image.jpg'

View File

@ -89,7 +89,6 @@ public class ItemBuilder {
// Fallback check for a vanilla material if a material tag could not be found
if (baseItem == null) {
baseItem = new MinecraftComponent().createItem(ctx, material, player, item);
;
if (baseItem == null) return new ItemStack(Material.AIR);
}

View File

@ -19,5 +19,4 @@ public class ConsoleCmdTag implements CommandTagResolver {
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), command);
});
}
}
}

View File

@ -16,6 +16,7 @@ public record PanelItem(
String tooltip,
String animate,
String conditions,
ClickActions actions,
ClickActions leftClick,
ClickActions rightClick,
ClickActions middleClick,
@ -41,6 +42,7 @@ public record PanelItem(
String tooltip,
String animate,
String conditions,
ClickActions actions,
ClickActions leftClick,
ClickActions rightClick,
ClickActions middleClick,
@ -65,6 +67,7 @@ public record PanelItem(
this.tooltip = tooltip;
this.animate = animate;
this.conditions = conditions;
this.actions = actions;
this.leftClick = leftClick;
this.rightClick = rightClick;
this.middleClick = middleClick;
@ -91,6 +94,7 @@ public record PanelItem(
String animate = section.getString("animate", "");
String conditions = section.getString("conditions", "");
ClickActions actions = ClickActions.fromSection(section.getConfigurationSection("actions"));
ClickActions leftClick = ClickActions.fromSection(section.getConfigurationSection("left-click"));
ClickActions rightClick = ClickActions.fromSection(section.getConfigurationSection("right-click"));
ClickActions middleClick = ClickActions.fromSection(section.getConfigurationSection("middle-click"));
@ -118,6 +122,7 @@ public record PanelItem(
tooltip,
animate,
conditions,
actions,
leftClick,
rightClick,
middleClick,
@ -136,6 +141,7 @@ public record PanelItem(
}
public ClickActions getClickActions(ClickType clickType) {
if(!actions.requirements().isEmpty() || !actions.commands().isEmpty()) return actions;
// LEFT case defaults
return switch (clickType) {
case RIGHT -> rightClick;