Class AbstractMenu

java.lang.Object
ua.mcchickenstudio.opencreative.menus.AbstractMenu
All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder, InventoryMenu
Direct Known Subclasses:
AbstractListMenu, BlocksManipulatorMenu, ConfirmationMenu, CreativeMenu, EnderChestMenu, ExecutorArgumentsMenu, Layout, MenusCategorySelectionMenu, ModuleSettingsMenu, PlayerControlMenu, RepeatConditionSelectionMenu, SelectionActionsMenu, TargetSelectionMenu, ValueTargetSelectionMenu, VariablesMenu, WanderMenu, WanderSettingsMenu, WorldAccessMenu, WorldEnvironmentMenu, WorldGenerationMenu, WorldModerationMenu, WorldsCompassMenu, WorldSettingsCategoryMenu, WorldSettingsFlagsMenu, WorldSettingsMenu

public abstract class AbstractMenu extends Object implements InventoryMenu

AbstractMenu

This class represents a menu with set items. It has methods to check player's click, open and close inventory events.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final org.bukkit.inventory.ItemStack
     
    protected final long
     
    protected final org.bukkit.inventory.ItemStack
     
    protected final org.bukkit.inventory.ItemStack
     
    protected final org.bukkit.inventory.ItemStack
     
    protected org.bukkit.inventory.Inventory
     
    protected final org.bukkit.inventory.ItemStack
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    AbstractMenu(int rows, String title)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract void
    fillItems(org.bukkit.entity.Player player)
     
    long
    Returns the creation time of menu in milliseconds of Unix format.
    @NotNull org.bukkit.inventory.Inventory
     
    @NotNull org.bukkit.inventory.ItemStack
    getItem(int slot)
     
    int
     
    int
     
     
    protected final boolean
    isClickedInMenuSlots(org.bukkit.event.inventory.InventoryClickEvent event)
     
    protected boolean
    isNotEmpty(org.bukkit.inventory.ItemStack item)
     
    protected final boolean
    isPlayerClicked(org.bukkit.event.inventory.InventoryClickEvent event)
     
    abstract void
    onClick(@NotNull org.bukkit.event.inventory.InventoryClickEvent event)
    Executes when player clicks in inventory.
    abstract void
    onOpen(@NotNull org.bukkit.event.inventory.InventoryOpenEvent event)
    Executes when player opens inventory and sees it first time.
    void
    open(@NotNull org.bukkit.entity.Player player)
    Opens the inventory for player.
    protected int
    reverse(int slot)
     
    void
    setItem(int slot, org.bukkit.inventory.ItemStack item)
     
    void
    setItem(org.bukkit.inventory.ItemStack item, int... slots)
     
    protected void
    setRows(int rows)
     
    void
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface InventoryMenu

    destroy, onClose
    Modifier and Type
    Method
    Description
    default void
    Destroys menus from memory and disables all event listeners for it.
    default void
    onClose(@NotNull org.bukkit.event.inventory.InventoryCloseEvent event)
    Executes when player closes inventory.
  • Field Details

    • creationTime

      protected final long creationTime
    • AIR_ITEM

      protected final org.bukkit.inventory.ItemStack AIR_ITEM
    • NO_PERMS_ITEM

      protected final org.bukkit.inventory.ItemStack NO_PERMS_ITEM
    • DISABLED_ITEM

      protected final org.bukkit.inventory.ItemStack DISABLED_ITEM
    • DECORATION_ITEM

      protected final org.bukkit.inventory.ItemStack DECORATION_ITEM
    • DECORATION_PANE_ITEM

      protected final org.bukkit.inventory.ItemStack DECORATION_PANE_ITEM
    • inventory

      protected org.bukkit.inventory.Inventory inventory
  • Constructor Details

    • AbstractMenu

      public AbstractMenu(int rows, String title)
  • Method Details

    • setItem

      public void setItem(int slot, org.bukkit.inventory.ItemStack item)
    • setItem

      public void setItem(org.bukkit.inventory.ItemStack item, int... slots)
    • getItem

      @NotNull public @NotNull org.bukkit.inventory.ItemStack getItem(int slot)
    • getInventory

      @NotNull public @NotNull org.bukkit.inventory.Inventory getInventory()
      Specified by:
      getInventory in interface org.bukkit.inventory.InventoryHolder
    • open

      public void open(@NotNull @NotNull org.bukkit.entity.Player player)
      Description copied from interface: InventoryMenu
      Opens the inventory for player.
      Specified by:
      open in interface InventoryMenu
      Parameters:
      player - player to open menus.
    • fillItems

      public abstract void fillItems(org.bukkit.entity.Player player)
    • onClick

      public abstract void onClick(@NotNull @NotNull org.bukkit.event.inventory.InventoryClickEvent event)
      Description copied from interface: InventoryMenu
      Executes when player clicks in inventory.
      Specified by:
      onClick in interface InventoryMenu
      Parameters:
      event - event of click in inventory.
    • onOpen

      public abstract void onOpen(@NotNull @NotNull org.bukkit.event.inventory.InventoryOpenEvent event)
      Description copied from interface: InventoryMenu
      Executes when player opens inventory and sees it first time. Useful for playing sounds or setting items.
      Specified by:
      onOpen in interface InventoryMenu
      Parameters:
      event - event of inventory open.
    • isClickedInMenuSlots

      protected final boolean isClickedInMenuSlots(org.bukkit.event.inventory.InventoryClickEvent event)
    • isPlayerClicked

      protected final boolean isPlayerClicked(org.bukkit.event.inventory.InventoryClickEvent event)
    • getSize

      public int getSize()
    • getRows

      public int getRows()
    • setRows

      protected void setRows(int rows)
    • reverse

      protected int reverse(int slot)
    • getTitle

      public String getTitle()
    • setTitle

      public void setTitle(String title)
    • getCreationTime

      public long getCreationTime()
      Description copied from interface: InventoryMenu
      Returns the creation time of menu in milliseconds of Unix format.
      Specified by:
      getCreationTime in interface InventoryMenu
      Returns:
      creation time of menu.
    • isNotEmpty

      protected boolean isNotEmpty(org.bukkit.inventory.ItemStack item)