skLib 0.1.0
Features
-
Custom Inventories: Create inventories with custom titles and types (e.g., Hopper, Dropper) or custom row-based sizes (up to 6 rows). Titles only support MiniMessage formatting.
-
Item & Click Handlers: Set items in inventory slots and attach custom click handlers to specific slots.
-
Inventory Management: Open inventories for players, track them by UUID, and prevent stealing if marked as unstealable.
-
Event Handling: Handles click, inventory close, and player quit events.
-
Utility Methods: Fill the inventory with one item and close inventories when needed.
How to Use
1. Create a Custom Inventory
GuiInventory gui = new GuiInventory("Title", InventoryTypes.HOPPER, true);
Or with rows: (uses chest)
GuiInventory gui = new GuiInventory("Title", 3, true);
2. Add Items & Click Handlers
gui.setItem(0, new ItemStack(Material.DIAMOND), clickEvent -> {
clickEvent.getPlayer().sendMessage("You clicked the diamond!");
});
3. Open Inventory
gui.open(player);
4. Close Inventory
clickEvent.close();
5. Fill Inventory (sets all of the slots in the inventory to the specified item)
gui.fillInventory(new ItemStack(Material.STONE));
This is a beta release, any suggestions will be appreciated!
If you encounter an issue, do report it!