java.lang.Object
me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
Direct Known Subclasses:
BlockMenuPreset, DirtyChestMenu

public class ChestMenu extends Object
An old remnant of CS-CoreLib. This will be removed once we updated everything. Don't look at the code, it will be gone soon, don't worry.
  • Constructor Details

    • ChestMenu

      public ChestMenu(String title)
      Creates a new ChestMenu with the specified Title
      Parameters:
      title - The title of the Menu
  • Method Details

    • setPlayerInventoryClickable

      public ChestMenu setPlayerInventoryClickable(boolean clickable)
      Toggles whether Players can access there Inventory while viewing this Menu
      Parameters:
      clickable - Whether the Player can access his Inventory
      Returns:
      The ChestMenu Instance
    • isPlayerInventoryClickable

      public boolean isPlayerInventoryClickable()
      Returns whether the Player's Inventory is accessible while viewing this Menu
      Returns:
      Whether the Player Inventory is clickable
    • setEmptySlotsClickable

      public ChestMenu setEmptySlotsClickable(boolean emptyClickable)
      Toggles whether Players can click the empty menu slots while viewing this Menu
      Parameters:
      emptyClickable - Whether the Player can click empty slots
      Returns:
      The ChestMenu Instance
    • isEmptySlotsClickable

      public boolean isEmptySlotsClickable()
      Returns whether the empty menu slots are clickable while viewing this Menu
      Returns:
      Whether the empty menu slots are clickable
    • addPlayerInventoryClickHandler

      public ChestMenu addPlayerInventoryClickHandler(ChestMenu.MenuClickHandler handler)
      Adds a ClickHandler to ALL Slots of the Player's Inventory
      Parameters:
      handler - The MenuClickHandler
      Returns:
      The ChestMenu Instance
    • addItem

      public ChestMenu addItem(int slot, ItemStack item)
      Adds an Item to the Inventory in that Slot
      Parameters:
      slot - The Slot in the Inventory
      item - The Item for that Slot
      Returns:
      The ChestMenu Instance
    • addItem

      public ChestMenu addItem(int slot, ItemStack item, ChestMenu.MenuClickHandler clickHandler)
      Adds an Item to the Inventory in that Slot as well as a Click Handler
      Parameters:
      slot - The Slot in the Inventory
      item - The Item for that Slot
      clickHandler - The MenuClickHandler for that Slot
      Returns:
      The ChestMenu Instance
    • getItemInSlot

      public ItemStack getItemInSlot(int slot)
      Returns the ItemStack in that Slot
      Parameters:
      slot - The Slot in the Inventory
      Returns:
      The ItemStack in that Slot
    • addMenuClickHandler

      public ChestMenu addMenuClickHandler(int slot, ChestMenu.MenuClickHandler handler)
      Executes a certain Action upon clicking an Item in the Menu
      Parameters:
      slot - The Slot in the Inventory
      handler - The MenuClickHandler
      Returns:
      The ChestMenu Instance
    • addMenuOpeningHandler

      public ChestMenu addMenuOpeningHandler(ChestMenu.MenuOpeningHandler handler)
      Executes a certain Action upon opening this Menu
      Parameters:
      handler - The MenuOpeningHandler
      Returns:
      The ChestMenu Instance
    • addMenuCloseHandler

      public ChestMenu addMenuCloseHandler(ChestMenu.MenuCloseHandler handler)
      Executes a certain Action upon closing this Menu
      Parameters:
      handler - The MenuCloseHandler
      Returns:
      The ChestMenu Instance
    • build

      public ChestMenu build()
      Finishes the Creation of the Menu
      Returns:
      The ChestMenu Instance
    • getContents

      public ItemStack[] getContents()
      Returns an Array containing the Contents of this Inventory
      Returns:
      The Contents of this Inventory
    • reset

      public void reset(boolean update)
    • replaceExistingItem

      public void replaceExistingItem(int slot, ItemStack item)
      Modifies an ItemStack in an ALREADY OPENED ChestMenu
      Parameters:
      slot - The Slot of the Item which will be replaced
      item - The new Item
    • open

      public void open(Player... players)
      Opens this Menu for the specified Player/s
      Parameters:
      players - The Players who will see this Menu
    • getMenuClickHandler

      public ChestMenu.MenuClickHandler getMenuClickHandler(int slot)
      Returns the MenuClickHandler which was registered for the specified Slot
      Parameters:
      slot - The Slot in the Inventory
      Returns:
      The MenuClickHandler registered for the specified Slot
    • getMenuCloseHandler

      public ChestMenu.MenuCloseHandler getMenuCloseHandler()
      Returns the registered MenuCloseHandler
      Returns:
      The registered MenuCloseHandler
    • getMenuOpeningHandler

      public ChestMenu.MenuOpeningHandler getMenuOpeningHandler()
      Returns the registered MenuOpeningHandler
      Returns:
      The registered MenuOpeningHandler
    • getPlayerInventoryClickHandler

      public ChestMenu.MenuClickHandler getPlayerInventoryClickHandler()
      Returns the registered MenuClickHandler for Player Inventories
      Returns:
      The registered MenuClickHandler
    • toInventory

      public Inventory toInventory()
      Converts this ChestMenu Instance into a normal Inventory
      Returns:
      The converted Inventory