XaGUI
Slots, borders, and locking
Place, update, fill, clear, and unlock GUI slots.
Set, update, and clear
menu.setSlot(10, Material.DIAMOND);
menu.setSlot(11, new ItemStack(Material.EMERALD, 16));
menu.setSlot(12, new GuiButton(Material.GOLD_INGOT).setName("&6Gold"));
menu.setSlot(1, 10, Material.NETHERITE_INGOT); // page, slot, value
menu.updateSlot(12, Material.IRON_INGOT); // retains the button callback
menu.clearSlot(12);
menu.clearSlot(1, 10);
menu.clearAllSlots(1);Overloads without a page use the current page. Prefer explicit pages when constructing multi-page menus. updateSlot does nothing if no button exists; setSlot creates or replaces one.
Fill several slots
In 1.6.1 the item comes before the slots:
ItemStack filler = new GuiButton(Material.GRAY_STAINED_GLASS_PANE)
.setName(" ").getItem();
menu.fillSlots(filler, 0, 1, 2, 3, 4);
menu.fillSlots(1, filler, 9, 17, 18, 26); // page, item, slotsCurrent-page overloads also accept Integer[], Set<Integer>, or List<Integer>. A GuiButtonInterface can be used with vararg slots.
Borders
menu.fillBorder(); // global filler on every page
menu.fillBorder(Material.BLUE_STAINED_GLASS_PANE); // current page
menu.fillBorder(1, filler); // explicit pageLocked slots
All GUI slots are locked by default. Unlock only items intended to move:
menu.setSlot(13, Material.DIAMOND);
menu.unlockButton(13);
menu.lockButton(13); // lock it againNote: in 1.6.1, isButtonLocked(slot) returns true when the current-page slot is in the internal unlocked set. Use unlockButton and lockButton for clear intent.