Class BlockMenuPreset

java.lang.Object
me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset

public abstract class BlockMenuPreset extends ChestMenu
  • Constructor Details

    • BlockMenuPreset

      protected BlockMenuPreset(@Nonnull String id, @Nonnull String title)
    • BlockMenuPreset

      protected BlockMenuPreset(@Nonnull String id, @Nonnull String title, boolean universal)
  • Method Details

    • init

      public abstract void init()
    • canOpen

      public abstract boolean canOpen(@Nonnull Block b, @Nonnull Player p)
      This method returns whether a given Player is allowed to open the BlockMenu of that Block. Override this as necessary.
      Parameters:
      b - The Block trying to be opened
      p - The Player who wants to open the BlockMenu
      Returns:
      Whether that Player is allowed
    • getSlotsAccessedByItemTransport

      public abstract int[] getSlotsAccessedByItemTransport(ItemTransportFlow flow)
    • onItemStackChange

      @Nullable protected ItemStack onItemStackChange(@Nonnull DirtyChestMenu menu, int slot, @Nullable ItemStack previous, @Nullable ItemStack next)
      This method is called whenever an ItemStack changes. You can override this as necessary if you need to listen to these events
      Parameters:
      menu - The Inventory affected by this
      slot - The affected slot
      previous - The ItemStack in that slot before the operation
      next - The ItemStack that it changes to
      Returns:
      The new outcome of this operation
    • newInstance

      public void newInstance(@Nonnull BlockMenu menu, @Nonnull Block b)
    • getSlotsAccessedByItemTransport

      public int[] getSlotsAccessedByItemTransport(DirtyChestMenu menu, ItemTransportFlow flow, ItemStack item)
    • replaceExistingItem

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

      public void drawBackground(@Nonnull ItemStack item, @Nonnull int[] slots)
      This method will draw unclickable background items into this BlockMenuPreset.
      Parameters:
      item - The ItemStack that should be used as background
      slots - The slots which should be treated as background
    • drawBackground

      public void drawBackground(@Nonnull int[] slots)
      This method will draw unclickable background items into this BlockMenuPreset.
      Parameters:
      slots - The slots which should be treated as background
    • addItem

      public ChestMenu addItem(int slot, @Nullable ItemStack item)
      Description copied from class: ChestMenu
      Adds an Item to the Inventory in that Slot
      Overrides:
      addItem in class ChestMenu
      Parameters:
      slot - The Slot in the Inventory
      item - The Item for that Slot
      Returns:
      The ChestMenu Instance
    • addMenuClickHandler

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

      @Nonnull public ChestMenu setSize(int size)
    • getSize

      public int getSize()
      This method returns the size of this BlockMenuPreset. If the size has not been determined yet, this will return -1.
      Returns:
      The size of this BlockMenuPreset
    • getTitle

      public String getTitle()
      This returns the title of this BlockMenuPreset, the title will be visible in every InventoryView for any menu created using this BlockMenuPreset.
      Returns:
      The inventory title for this BlockMenuPreset
    • isUniversal

      public boolean isUniversal()
      This method returns whether this BlockMenuPreset will spawn a UniversalBlockMenu.
      Returns:
      Whether this BlockMenuPreset is universal
    • getPresetSlots

      @Nonnull public Set<Integer> getPresetSlots()
    • getInventorySlots

      @Nonnull public Set<Integer> getInventorySlots()
    • clone

      protected void clone(@Nonnull DirtyChestMenu menu)
    • newInstance

      public void newInstance(@Nonnull BlockMenu menu, @Nonnull Location l)
    • getID

      @Nonnull public String getID()
      This returns the id of the associated SlimefunItem. It also doubles as the id for this BlockMenuPreset.
      Returns:
      Our identifier
    • getSlimefunItem

      @Nonnull public SlimefunItem getSlimefunItem()
      This returns the SlimefunItem associated with this BlockMenuPreset.
      Returns:
      The associated SlimefunItem
    • getPreset

      @Nullable public static BlockMenuPreset getPreset(@Nullable String id)
    • isInventory

      public static boolean isInventory(String id)
    • isUniversalInventory

      public static boolean isUniversalInventory(String id)