Package me.totalfreedom.display
Class AbstractMenu
java.lang.Object
me.totalfreedom.display.AbstractMenu
Represents a menu that can be opened by a player.
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMenu(int size) Creates a new menu with the specified size. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose(@NotNull org.bukkit.entity.Player player) Closes this menu for the specified player.voiddelete()Deletes this menu.static Map<UUID,AbstractMenu> org.bukkit.inventory.ItemStacknewItem(@NotNull org.bukkit.Material material, @NotNull net.kyori.adventure.text.Component name) Creates a new item with the specified material and name.org.bukkit.inventory.ItemStacknewItem(@NotNull org.bukkit.Material material, @NotNull net.kyori.adventure.text.Component name, @NotNull net.kyori.adventure.text.Component... lore) Creates a new item with the specified material, name, and lore.voidopen(@NotNull org.bukkit.entity.Player player) Opens this menu for the specified player.voidsetItem(int slot, @NotNull org.bukkit.inventory.ItemStack stack) Sets the item at the specified slot.voidsetItem(int slot, @NotNull org.bukkit.inventory.ItemStack stack, @Nullable ClickAction action) Sets the item at the specified slot.
-
Constructor Details
-
AbstractMenu
protected AbstractMenu(int size) Creates a new menu with the specified size.- Parameters:
size- The size of the menu.
-
-
Method Details
-
getInvByUUID
- Returns:
- A map of all menus by their UUID.
-
getOpenInvs
- Returns:
- A map of all open menus by the player's UUID.
-
getDisplayableUUID
- Returns:
- The displayable UUID of this menu.
-
setItem
public void setItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack stack) Sets the item at the specified slot.- Parameters:
slot- The slot to set the item at.stack- The item to set.
-
setItem
public void setItem(int slot, @NotNull @NotNull org.bukkit.inventory.ItemStack stack, @Nullable @Nullable ClickAction action) Sets the item at the specified slot.- Parameters:
slot- The slot to set the item at.stack- The item to set.action- The action to perform when the item is clicked.
-
getDisplayable
- Returns:
- The displayable that represents this menu.
-
open
public void open(@NotNull @NotNull org.bukkit.entity.Player player) Opens this menu for the specified player.- Parameters:
player- The player to open the menu for.
-
delete
public void delete()Deletes this menu. -
close
public void close(@NotNull @NotNull org.bukkit.entity.Player player) Closes this menu for the specified player.- Parameters:
player- The player to close the menu for.
-
getActions
- Returns:
- A map of all actions by their slot.
-
newItem
public org.bukkit.inventory.ItemStack newItem(@NotNull @NotNull org.bukkit.Material material, @NotNull @NotNull net.kyori.adventure.text.Component name) Creates a new item with the specified material and name.- Parameters:
material- The material of the item.name- The name of the item.- Returns:
- The created item.
-
newItem
public org.bukkit.inventory.ItemStack newItem(@NotNull @NotNull org.bukkit.Material material, @NotNull @NotNull net.kyori.adventure.text.Component name, @NotNull @NotNull net.kyori.adventure.text.Component... lore) Creates a new item with the specified material, name, and lore.- Parameters:
material- The material of the item.name- The name of the item.lore- The lore of the item.- Returns:
- The created item.
-