Package net.realdarkstudios.commons.menu
Class MCMenu
java.lang.Object
net.realdarkstudios.commons.menu.MCMenu
- Direct Known Subclasses:
PaginationMenu
The base Menu class. This handles the dimensions, title, and slots, as well as opening, closing, and updating the menu.
- Since:
- 0.3.0.0
- See Also:
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final MenuItemAn empty slot item, with a gray stained glass pane and no title -
Constructor Summary
ConstructorsConstructorDescriptionMCMenu(LocalizedMessages.Key titleKey, MCMenu.MenuSize size, org.bukkit.plugin.java.JavaPlugin plugin, Object... formatArgs) Creates a new MCMenuMCMenu(LocalizedMessages.Key titleKey, MCMenu.MenuSize size, org.bukkit.plugin.java.JavaPlugin plugin, MCMenu parent, Object... formatArgs) Creates a new MCMenu -
Method Summary
Modifier and TypeMethodDescriptionClears all the slots in this menuvoidclose(org.bukkit.entity.Player player) Closes the menu for the given playerprotected booleancoordCheck(org.bukkit.Location loc) Checks if the given coordinates is not equal to the default (0, 0, 0)voiddelete()Deletes this menustatic MenuItemCreates an error item, a bedrock item with a custom nameFills the empty slots withEMPTY_SLOT_ITEMfillEmptySlots(MenuItem item) Fills the empty slots with the specified itemgetName()Gets the name of this menuGets the parent of this menugetSize()Gets the size of this menuintGets the slot count of this menuGets the title path of this menubooleanChecks if this menu has a parentvoidonInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event) Called when a slot in the inventory is clickedvoidopen(org.bukkit.entity.Player player) Opens the menu for the given playerSets an item in the specified slot indexvoidSets the parent of this menuprotected booleanstringCheck(String str) Checks if the given string is not null or emptyvoidupdate(org.bukkit.entity.Player player) Updates the menu for the given player
-
Field Details
-
EMPTY_SLOT_ITEM
An empty slot item, with a gray stained glass pane and no title
-
-
Constructor Details
-
Method Details
-
errorItem
Creates an error item, a bedrock item with a custom name- Parameters:
name- The name of this item- Returns:
- The error item
-
getTitleKey
Gets the title path of this menu- Returns:
- The title path
-
getName
Gets the name of this menu- Returns:
- The name
-
getSize
Gets the size of this menu- Returns:
- The size
-
getSlotCount
public int getSlotCount()Gets the slot count of this menu- Returns:
- The slot count
-
hasParent
public boolean hasParent()Checks if this menu has a parent- Returns:
trueif this menu has a parent,falseotherwise
-
getParent
Gets the parent of this menu- Returns:
- The parent ment
-
clearAllSlots
Clears all the slots in this menu- Returns:
- This menu
-
fillEmptySlots
Fills the empty slots withEMPTY_SLOT_ITEM- Returns:
- This menu
-
open
public void open(org.bukkit.entity.Player player) Opens the menu for the given player- Parameters:
player- ThePlayerto open this menu for
-
close
public void close(org.bukkit.entity.Player player) Closes the menu for the given player- Parameters:
player- ThePlayerto close this menu for
-
update
public void update(org.bukkit.entity.Player player) Updates the menu for the given player- Parameters:
player- ThePlayerto update this menu for
-
onInventoryClick
public void onInventoryClick(org.bukkit.event.inventory.InventoryClickEvent event) Called when a slot in the inventory is clicked- Parameters:
event- TheInventoryClickEventthat was passed
-
delete
public void delete()Deletes this menu -
coordCheck
protected boolean coordCheck(org.bukkit.Location loc) Checks if the given coordinates is not equal to the default (0, 0, 0)- Parameters:
loc- TheLocationto check- Returns:
trueif the location is not the default,falseotherwise
-
stringCheck
Checks if the given string is not null or empty- Parameters:
str- TheStringto check- Returns:
trueif the string is not null or empty,falseotherwise
-