Package me.efekos.simpler.menu
Class Menu
java.lang.Object
me.efekos.simpler.menu.Menu
- All Implemented Interfaces:
 org.bukkit.inventory.InventoryHolder
- Direct Known Subclasses:
 PaginatedMenu
Represents a custom menu. Extend this class to make your custom menus.
- 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionprotected voidback()Closes this menu and open the last menu player visited before this one.abstract booleanReturns a boolean that indicates click cancels for this menu.protected org.bukkit.inventory.ItemStackcreateItem(org.bukkit.Material material, String displayName, String... lore) Quickly crates anItemStackaccording to the parameters.protected org.bukkit.inventory.ItemStackcreateSkull(org.bukkit.entity.Player owner, String displayName, String... lore) Quickly creates a skull owned byPlayergiven.abstract voidfill()Main method to set menu items.protected voidfillEmptyWith(org.bukkit.inventory.ItemStack tem) Fills all the empty slots with theItemStackgiven.@NotNull org.bukkit.inventory.InventoryGet the object's inventory.abstract intgetRows()Returns a row amount for this menu.intgetSlots()Returns the real slot amount of this menu, which isgetRows()*9.abstract StringgetTitle()Returns a title for this menu.abstract voidonClick(org.bukkit.event.inventory.InventoryClickEvent event) Executes when someone clicks to an item in this menu.abstract voidonClose(org.bukkit.event.inventory.InventoryCloseEvent event) Executes when someone closes this menu.abstract voidonOpen(org.bukkit.event.inventory.InventoryOpenEvent event) Executes when someone opens this menu.voidopen()Creates an inventory for this menu and shows it to theowner.protected voidrefresh()Refreshes the menu items. 
- 
Field Details
- 
inventory
protected org.bukkit.inventory.Inventory inventoryCurrent inventory that is being used by this holder. - 
owner
protected org.bukkit.entity.Player ownerPlayerwho interacted with this menu. - 
data
Temporarily data about the owner. You can store something about thisPlayerto use it in another menu. 
 - 
 - 
Constructor Details
 - 
Method Details
- 
cancelAllClicks
public abstract boolean cancelAllClicks()Returns a boolean that indicates click cancels for this menu.- Returns:
 - Should all the clicks at this menu get cancelled?
 
 - 
getRows
public abstract int getRows()Returns a row amount for this menu.- Returns:
 - How many rows this menu will have. Your menu will have 
getRows()*9 slots, since every row makes 9 slot. 
 - 
getTitle
Returns a title for this menu.- Returns:
 - A title for this menu.
 
 - 
onClick
public abstract void onClick(org.bukkit.event.inventory.InventoryClickEvent event) Executes when someone clicks to an item in this menu.- Parameters:
 event- Instance of the event.
 - 
onClose
public abstract void onClose(org.bukkit.event.inventory.InventoryCloseEvent event) Executes when someone closes this menu.- Parameters:
 event- Instance of the event.
 - 
onOpen
public abstract void onOpen(org.bukkit.event.inventory.InventoryOpenEvent event) Executes when someone opens this menu.- Parameters:
 event- Instance of the event.
 - 
fill
public abstract void fill()Main method to set menu items. Add the buttons, items and glass panes to your menu inside this method. - 
getInventory
@NotNull public @NotNull org.bukkit.inventory.Inventory getInventory()Get the object's inventory.- Specified by:
 getInventoryin interfaceorg.bukkit.inventory.InventoryHolder- Returns:
 - The inventory.
 
 - 
open
public void open()Creates an inventory for this menu and shows it to theowner. - 
createItem
protected org.bukkit.inventory.ItemStack createItem(org.bukkit.Material material, String displayName, String... lore) Quickly crates anItemStackaccording to the parameters.- Parameters:
 material- Type of the item.displayName- Display name of the item.lore- Lore of the item.- Returns:
 ItemStackgenerated.
 - 
createSkull
protected org.bukkit.inventory.ItemStack createSkull(org.bukkit.entity.Player owner, String displayName, String... lore) Quickly creates a skull owned byPlayergiven.- Parameters:
 owner- Owner of the skulldisplayName- Display name for the itemlore- Lore for the item- Returns:
 ItemStackgenerated. Guaranteed to be anMaterial.PLAYER_HEAD.
 - 
back
protected void back()Closes this menu and open the last menu player visited before this one. - 
refresh
protected void refresh()Refreshes the menu items. - 
fillEmptyWith
protected void fillEmptyWith(org.bukkit.inventory.ItemStack tem) Fills all the empty slots with theItemStackgiven.- Parameters:
 tem- AnItemStackto put in every empty slot.
 - 
getSlots
public int getSlots()Returns the real slot amount of this menu, which isgetRows()*9.- Returns:
 - Slot amount of this menu.
 
 
 -