Adding custom buttons - VerduzcoTristan/GUIUtility GitHub Wiki

Create an Entry

You probably want to make your own functions for when the GUI, that's kind of the whole point right? To create an item with custom functions, you need to use the Entry class

Here is an example of the class in action:

    public class HealEntry implements Entry {
    
        public HealEntry(Material material, int slot)
        {
            super(material, slot); // Not required, but allows for simple implementation
            this.name = "&6&lHeal";
            this.quantity = 64;
            this.lore.add("&r&6&lbitch");
        }

        // Runs when your item/button is clicked
        @Override
        public void onClick(InventoryClickEvent event)
        {
            Player player = (Player) event.getView().getPlayer();
    
            player.setHealth(20);
            player.sendMessage("Healed");
        }
    }

Add Entry to GUI

Now we need to add this entry to our GUI. This line goes after invoking the super/parent constructor in your gui class. Example here

        this.entries.add(new HealEntry(Material.GOLDEN_APPLE, 14));

Now that you know all the essential things that make up a well made GUI, its about time to open it now isn't it?

⚠️ **GitHub.com Fallback** ⚠️