Class Menu.Builder<T extends Menu.Builder<T>>
java.lang.Object
me.tayebyassine.homestead.gui.Menu.Builder<T>
- Enclosing class:
Menu
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<Integer, BiConsumer<org.bukkit.entity.Player, org.bukkit.event.inventory.InventoryClickEvent>> protected org.bukkit.inventory.ItemStackprotected Stringprotected booleanprotected final intprotected String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedprotectedprotectedBuilder(String menuKey, Placeholder placeholder, int size) protectedBuilder(String menuKey, Placeholder placeholder, int size, boolean passthrough) -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds and returns a newMenuinstance from this builder's configuration.button(int slot, org.bukkit.inventory.ItemStack item, BiConsumer<org.bukkit.entity.Player, org.bukkit.event.inventory.InventoryClickEvent> callback) Places a clickable button in the specified slot with an associated callback.Configures the menu to fill all empty slots with the default empty slot item on build.fillEmptySlots(org.bukkit.inventory.ItemStack filler) Configures the menu to fill all empty slots with the given filler item on build.item(int slot, org.bukkit.inventory.ItemStack item) Places an item in the specified slot.passthrough(boolean passthrough) Sets whether clicks in this menu pass through to the player's inventory.protected Tself()
-
Field Details
-
size
protected final int size -
items
-
buttons
protected final Map<Integer, BiConsumer<org.bukkit.entity.Player, org.bukkit.event.inventory.InventoryClickEvent>> buttons -
title
-
passthrough
protected boolean passthrough -
filler
protected org.bukkit.inventory.ItemStack filler
-
-
Constructor Details
-
Builder
-
Builder
-
Builder
-
Builder
-
-
Method Details
-
self
-
passthrough
Sets whether clicks in this menu pass through to the player's inventory.- Parameters:
passthrough-trueto allow clicks to pass through- Returns:
- this builder for chaining
-
item
Places an item in the specified slot.- Parameters:
slot- the slot index to place the item initem- the item to place- Returns:
- this builder for chaining
-
button
public T button(int slot, org.bukkit.inventory.ItemStack item, BiConsumer<org.bukkit.entity.Player, org.bukkit.event.inventory.InventoryClickEvent> callback) Places a clickable button in the specified slot with an associated callback.- Parameters:
slot- the slot index for the buttonitem- the item to displaycallback- the action to execute when the button is clicked, ornullfor no action- Returns:
- this builder for chaining
-
fillEmptySlots
Configures the menu to fill all empty slots with the given filler item on build.- Parameters:
filler- the item to fill empty slots with- Returns:
- this builder for chaining
-
fillEmptySlots
Configures the menu to fill all empty slots with the default empty slot item on build.- Returns:
- this builder for chaining
-
build
-