Class Layout
java.lang.Object
ua.mcchickenstudio.opencreative.menus.AbstractMenu
ua.mcchickenstudio.opencreative.coding.menus.layouts.Layout
- All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder,InventoryMenu
- Direct Known Subclasses:
LayoutMaker
Layout
This class represents a inventory menu, that opens when player clicks on coding container to fill arguments.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ActionTypeprotected final List<ParameterButton> protected final ArgumentSlot[]Fields inherited from class ua.mcchickenstudio.opencreative.menus.AbstractMenu
AIR_ITEM, creationTime, DECORATION_ITEM, DECORATION_PANE_ITEM, DISABLED_ITEM, inventory, NO_PERMS_ITEM -
Constructor Summary
ConstructorsConstructorDescriptionLayout(int rows, @NotNull ActionType actionType, @NotNull org.bukkit.block.Block containerBlock) Creates a coding container layout menu. -
Method Summary
Modifier and TypeMethodDescriptionprotected @NotNull ParameterButtoncreateParamButton(@NotNull ParameterSlot parameter, Object value) Creates and returns parameter button.protected abstract voidFills menu with argument glasses and values.voidfillItems(org.bukkit.entity.Player player) Returns list of slots, items from will be saved into coding container after closing menu.protected @NotNull org.bukkit.inventory.ItemStackgetArgumentValueFromContainer(int slot) Returns argument value item from coding container.getCentredSlots(int count, int row) Returns list of slots, that will be used to display a row of items in more beautiful place.@NotNull Set<org.bukkit.entity.Player> Returns set of players, who have opened this menu.voidonClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent event) Executes when player clicks in inventory.final voidonClose(@NotNull org.bukkit.event.inventory.InventoryCloseEvent event) Executes when player closes inventory.voidonOpen(@NotNull org.bukkit.event.inventory.InventoryOpenEvent event) Executes when player opens inventory and sees it first time.protected voidsetArgSlot(int argNumber, int... slots) Sets argument slot in slot.protected voidsetArgSlotCross(int argNumber, int slot) Sets argument slot with vertical and horizontal glass panes in slot.protected voidsetArgSlotHorizontal(int argNumber, int slot) Sets argument slot with horizontal glass panes in slot.protected voidsetArgSlotVertical(int argNumber, int slot) Sets argument slot with vertical glass panes in slot.protected voidsetGlass(int argNumber, int... slots) Sets glass pane in slot.Methods inherited from class ua.mcchickenstudio.opencreative.menus.AbstractMenu
getCreationTime, getInventory, getItem, getRows, getSize, getTitle, isClickedInMenuSlots, isNotEmpty, isPlayerClicked, open, reverse, setItem, setItem, setRows, setTitleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ua.mcchickenstudio.opencreative.menus.InventoryMenu
destroy
-
Field Details
-
actionType
-
argsSlots
-
parameterButtons
-
requiredSlots
-
-
Constructor Details
-
Layout
public Layout(int rows, @NotNull @NotNull ActionType actionType, @NotNull @NotNull org.bukkit.block.Block containerBlock) Creates a coding container layout menu.- Parameters:
rows- amount of rows in layout.actionType- type of action, that has arguments.containerBlock- container block.
-
-
Method Details
-
fillItems
public void fillItems(org.bukkit.entity.Player player) - Specified by:
fillItemsin classAbstractMenu
-
fillArgumentItems
protected abstract void fillArgumentItems()Fills menu with argument glasses and values.- See Also:
-
getArgumentValueFromContainer
@NotNull protected @NotNull org.bukkit.inventory.ItemStack getArgumentValueFromContainer(int slot) Returns argument value item from coding container.- Parameters:
slot- slot of item inside coding container.- Returns:
- value item, or empty item.
-
onClick
public void onClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent event) Description copied from interface:InventoryMenuExecutes when player clicks in inventory.- Specified by:
onClickin interfaceInventoryMenu- Specified by:
onClickin classAbstractMenu- Parameters:
event- event of click in inventory.
-
onOpen
public void onOpen(@NotNull @NotNull org.bukkit.event.inventory.InventoryOpenEvent event) Description copied from interface:InventoryMenuExecutes when player opens inventory and sees it first time. Useful for playing sounds or setting items.- Specified by:
onOpenin interfaceInventoryMenu- Specified by:
onOpenin classAbstractMenu- Parameters:
event- event of inventory open.
-
onClose
public final void onClose(@NotNull @NotNull org.bukkit.event.inventory.InventoryCloseEvent event) Description copied from interface:InventoryMenuExecutes when player closes inventory.NOTE: Menu should be unregistered after closing it.
- Parameters:
event- event of inventory close.- See Also:
-
setArgSlotVertical
protected void setArgSlotVertical(int argNumber, int slot) Sets argument slot with vertical glass panes in slot.- Parameters:
argNumber- number of argument.slot- slot to put item.
-
setArgSlotHorizontal
protected void setArgSlotHorizontal(int argNumber, int slot) Sets argument slot with horizontal glass panes in slot.- Parameters:
argNumber- number of argument.slot- slot to put item.
-
setArgSlotCross
protected void setArgSlotCross(int argNumber, int slot) Sets argument slot with vertical and horizontal glass panes in slot.- Parameters:
argNumber- number of argument.slot- slot to put item.
-
setGlass
protected void setGlass(int argNumber, int... slots) Sets glass pane in slot.- Parameters:
argNumber- number of argument.slots- slots to put glass pane.
-
setArgSlot
protected void setArgSlot(int argNumber, int... slots) Sets argument slot in slot.- Parameters:
argNumber- number of argument.slots- slots to put argument slot.
-
getArgsSlots
Returns list of slots, items from will be saved into coding container after closing menu.- Returns:
- list of slots with argument items.
-
getCentredSlots
Returns list of slots, that will be used to display a row of items in more beautiful place.- Parameters:
count- count of items in row (1-9)row- row (1-6)- Returns:
- list of centered slots.
-
getViewers
Returns set of players, who have opened this menu.- Returns:
- set of menu viewers.
-