XaGui Docs
Interfaces

GuiButtonInterface

Methods

MethodReturns
getIcon()Material
setIcon(Material icon)
setItem(ItemStack item)
withListener(Consumer<InventoryClickEvent> listener)GuiButton
withListener(ButtonListener listener)GuiButton
withRedirect(() -> GuiMenu)GuiButton
callRedirect(Player p)
nullable getClickListener()ButtonListener
getIcon()Material
setIcon(Material icon)GuiButton
setItem(ItemStack item)GuiButton
setName(string name)GuiButton
addItemFlag(ItemFlag flag)GuiButton
removeItemFlag(ItemFlag flag)GuiButton
setAmount(int amount)GuiButton
setDurability(short durability)GuiButton
addEnchantment(Enchantment enchantment)GuiButton
addEnchantment(Enchantment enchantment, int level)GuiButton
removeEnchantment(Enchantment enchantment)GuiButton
removeAllEnchantments()GuiButton
setLore(String... lore)GuiButton
setLoreList(ArrayList<String> list)GuiButton
setLoreArray(String[] lore)GuiButton
addLore(String... lore)GuiButton
addLoreList(ArrayList<String> list)GuiButton
addLoreArray(String[] lore)GuiButton
clearLore()
clone()GuiButton

Examples

GuiButton closeButton = new GuiButton(new ItemStack(Material.BARRIER))
        .setName("&cClose")
        .withListener((event) -> {
            player.closeInventory();
        }).setLore(" ", "&eClick to close");
 
GuiButton ironSword = new GuiButton(new ItemStack(Material.IRON_SWORD))
        .setName("&aIron Sword")
        .addItemFlag(ItemFlag.HIDE_ENCHANTS)
        .addEnchantment(Enchantment.DAMAGE_ALL, 5)
        .setDurability((short) 50);

On this page