Inventory Buttons are items that the InputTracker “pins” to specific slots in a player’s inventory or crafting grid. These items are strictly managed to be interactive but non-removable.
Features
- Anti-Theft: Players cannot drop, move, or swap these items.
- Auto-Restore: If a button is lost (e.g., server crash, world change), the extension automatically re-populates the designated slot.
- PDC-Based: Buttons are identified by unique Persistent Data Container keys — regular items with the same material are never affected.
- 7 Click Types: Each binding supports LEFT, RIGHT, SHIFT_LEFT, SHIFT_RIGHT, DROP, DOUBLE_CLICK, and ALL fallback.
- Criteria Support: Both the button and each click binding can have their own criteria conditions.
- World Interaction: Buttons in the hotbar trigger LEFT/RIGHT actions when used in the world.
A unique feature of this extension is the ability to place buttons within the 2x2 (Inventory) or 3x3 (Workbench) crafting grid.
- Slot 0: The crafting result slot.
- Slots 1-4: The crafting matrix slots.
By setting isCraftingGrid: true, you can turn the crafting area into a permanent control panel for your players.
Pro Tip: Place an item in Slot 0 (Result) to act as a “Submit” or “Process” button. Use Slots 1-4 as status indicators.
Crafting Safety
If a button occupies any crafting matrix slot (1-4), the crafting result is automatically nullified to prevent item duplication.
Click Type Reference
| ClickType | Description | World Interact |
|---|
ALL | Matches any click (fallback) | ✓ |
LEFT | Left click | ✓ |
RIGHT | Right click | ✓ |
SHIFT_LEFT | Shift + left click | ✓* |
SHIFT_RIGHT | Shift + right click | ✓* |
DROP | Q key when hovering the button | — |
DOUBLE_CLICK | Double click | — |
*World interaction for SHIFT types uses the binding’s global click type — only LEFT/RIGHT are detected from PlayerInteractEvent.
How it Works
The InventoryButtonService monitors these events:
| Event | Purpose |
|---|
InventoryClickEvent | Handle button clicks, prevent moving to cursor |
InventoryDragEvent | Prevent dragging buttons |
PlayerDropItemEvent | Block dropping buttons, trigger DROP actions |
PlayerSwapHandItemsEvent | Prevent swapping buttons |
PlayerInteractEvent | Cancel world interaction, trigger LEFT/RIGHT |
PlayerInteractEntityEvent | Cancel entity interaction, trigger RIGHT |
PlayerJoinEvent | Populate buttons on join |
PrepareItemCraftEvent | Handle result buttons, prevent crafting with buttons |
InventoryCloseEvent | Clean up crafting grid buttons, restore positions |
Example Configuration
inventoryButtons:
- slot: 1
isCraftingGrid: true
item:
type: "NETHER_STAR"
name: "<gold>Character Menu"
lore:
- "<gray>Click to open your stats."
clickActions:
- clickType: LEFT
actions:
- "open_character_gui_action"
- clickType: RIGHT
actions:
- "open_settings_action"