Skip to content

v0.1.0

Latest
Compare
Choose a tag to compare
@lmaoskript lmaoskript released this 25 Apr 09:40
· 3 commits to main since this release
8c533b6

skLib 0.1.0

Features

  1. 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.

  2. Item & Click Handlers: Set items in inventory slots and attach custom click handlers to specific slots.

  3. Inventory Management: Open inventories for players, track them by UUID, and prevent stealing if marked as unstealable.

  4. Event Handling: Handles click, inventory close, and player quit events.

  5. 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!