Class BlockMenuPreset
java.lang.Object
city.norain.slimefun4.holder.SlimefunInventoryHolder
me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
me.mrCookieSlime.Slimefun.api.inventory.BlockMenuPreset
- All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder
- Direct Known Subclasses:
UniversalMenuPreset
-
Nested Class Summary
Nested classes/interfaces inherited from class me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
ChestMenu.AdvancedMenuClickHandler, ChestMenu.MenuClickHandler, ChestMenu.MenuCloseHandler, ChestMenu.MenuOpeningHandler
-
Field Summary
FieldsFields inherited from class city.norain.slimefun4.holder.SlimefunInventoryHolder
inventory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaddItem
(int slot, org.bukkit.inventory.ItemStack item) Adds an Item to the Inventory in that SlotaddMenuClickHandler
(int slot, ChestMenu.MenuClickHandler handler) Executes a certain Action upon clicking an Item in the Menuabstract boolean
canOpen
(org.bukkit.block.Block b, org.bukkit.entity.Player p) protected void
clone
(DirtyChestMenu menu) void
drawBackground
(int[] slots) This method will draw unclickable background items into thisBlockMenuPreset
.void
drawBackground
(org.bukkit.inventory.ItemStack item, int[] slots) This method will draw unclickable background items into thisBlockMenuPreset
.getID()
This returns the id of the associatedSlimefunItem
.static BlockMenuPreset
int
getSize()
This method returns the size of thisBlockMenuPreset
.This returns theSlimefunItem
associated with thisBlockMenuPreset
.int[]
getSlotsAccessedByItemTransport
(DirtyChestMenu menu, ItemTransportFlow flow, org.bukkit.inventory.ItemStack item) abstract int[]
getTitle()
This returns the title of thisBlockMenuPreset
, the title will be visible in everyInventoryView
for any menu created using thisBlockMenuPreset
.abstract void
init()
static boolean
isInventory
(String id) void
newInstance
(BlockMenu menu, org.bukkit.block.Block b) void
newInstance
(BlockMenu menu, org.bukkit.Location l) protected org.bukkit.inventory.ItemStack
onItemStackChange
(DirtyChestMenu menu, int slot, org.bukkit.inventory.ItemStack previous, org.bukkit.inventory.ItemStack next) This method is called whenever anItemStack
changes.void
replaceExistingItem
(int slot, org.bukkit.inventory.ItemStack item) Modifies an ItemStack in an ALREADY OPENED ChestMenusetSize
(int size) Methods inherited from class me.mrCookieSlime.CSCoreLibPlugin.general.Inventory.ChestMenu
addItem, addMenuCloseHandler, addMenuOpeningHandler, addPlayerInventoryClickHandler, addViewer, build, contains, getContents, getItemInSlot, getMenuClickHandler, getMenuCloseHandler, getMenuOpeningHandler, getPlayerInventoryClickHandler, isEmptySlotsClickable, isPlayerInventoryClickable, isSizeAutomaticallyInferred, lock, locked, open, removeViewer, reset, setEmptySlotsClickable, setPlayerInventoryClickable, toInventory, unlock
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.bukkit.inventory.InventoryHolder
getInventory
-
Field Details
-
occupiedSlots
-
-
Constructor Details
-
BlockMenuPreset
-
-
Method Details
-
init
public abstract void init() -
canOpen
public abstract boolean canOpen(@Nonnull org.bukkit.block.Block b, @Nonnull org.bukkit.entity.Player p) This method returns whether a givenPlayer
is allowed to open theBlockMenu
of thatBlock
. Override this as necessary.- Parameters:
b
- TheBlock
trying to be openedp
- ThePlayer
who wants to open theBlockMenu
- Returns:
- Whether that
Player
is allowed
-
getSlotsAccessedByItemTransport
-
onItemStackChange
@Nullable protected org.bukkit.inventory.ItemStack onItemStackChange(@Nonnull DirtyChestMenu menu, int slot, @Nullable org.bukkit.inventory.ItemStack previous, @Nullable org.bukkit.inventory.ItemStack next) This method is called whenever anItemStack
changes. You can override this as necessary if you need to listen to these events- Parameters:
menu
- TheInventory
affected by thisslot
- The affected slotprevious
- TheItemStack
in that slot before the operationnext
- TheItemStack
that it changes to- Returns:
- The new outcome of this operation
-
newInstance
-
getSlotsAccessedByItemTransport
public int[] getSlotsAccessedByItemTransport(DirtyChestMenu menu, ItemTransportFlow flow, org.bukkit.inventory.ItemStack item) -
replaceExistingItem
public void replaceExistingItem(int slot, org.bukkit.inventory.ItemStack item) Description copied from class:ChestMenu
Modifies an ItemStack in an ALREADY OPENED ChestMenu- Overrides:
replaceExistingItem
in classChestMenu
- Parameters:
slot
- The Slot of the Item which will be replaceditem
- The new Item
-
drawBackground
public void drawBackground(@Nonnull org.bukkit.inventory.ItemStack item, @Nonnull int[] slots) This method will draw unclickable background items into thisBlockMenuPreset
.- Parameters:
item
- TheItemStack
that should be used as backgroundslots
- The slots which should be treated as background
-
drawBackground
public void drawBackground(@Nonnull int[] slots) This method will draw unclickable background items into thisBlockMenuPreset
.- Parameters:
slots
- The slots which should be treated as background
-
addItem
Description copied from class:ChestMenu
Adds an Item to the Inventory in that Slot -
addMenuClickHandler
Description copied from class:ChestMenu
Executes a certain Action upon clicking an Item in the Menu- Overrides:
addMenuClickHandler
in classChestMenu
- Parameters:
slot
- The Slot in the Inventoryhandler
- The MenuClickHandler- Returns:
- The ChestMenu Instance
-
setSize
-
getSize
public int getSize()This method returns the size of thisBlockMenuPreset
. If the size has not been determined yet, this will return -1.- Overrides:
getSize
in classChestMenu
- Returns:
- The size of this
BlockMenuPreset
-
getTitle
This returns the title of thisBlockMenuPreset
, the title will be visible in everyInventoryView
for any menu created using thisBlockMenuPreset
.- Returns:
- The inventory title for this
BlockMenuPreset
-
getPresetSlots
-
getInventorySlots
-
clone
-
newInstance
-
getID
This returns the id of the associatedSlimefunItem
. It also doubles as the id for thisBlockMenuPreset
.- Returns:
- Our identifier
-
getSlimefunItem
This returns theSlimefunItem
associated with thisBlockMenuPreset
.- Returns:
- The associated
SlimefunItem
-
getPreset
-
isInventory
-