Add actions
Add custom actions and call them
You can even insert a variable map that would put variables inside the code when calling this action.
// Adding actions
AddonAction action = new AddonAction("TestAction", // Action name
Material.REDSTONE, // Action gui material
new String[] { "&7This is a test" }) // Action lore
provider.addAddon(
new PluginAddon("PluginName", XMaterial.WRITABLE_BOOK.get())
.action(action)
);
// Call the action (will run the action for the item if the item has actions for it.)
action.call(player, // The player
itemStack, // The item (as ItemStack)
new HashMap<String, Object>() {{ // Custom variables that would be avaiable when running
put("exampleVariable", player.getDisplayName());
}})Last updated