Class InputSlot
java.lang.Object
me.eddie.inventoryguiapi.gui.elements.AbstractGUIElement
me.eddie.inventoryguiapi.gui.elements.InputSlot
- All Implemented Interfaces:
GUIElement
Represents a GUIElement that defines a slot where players can input item.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceRepresents the action that should happen when this input slot is interacted with -
Field Summary
Fields inherited from class me.eddie.inventoryguiapi.gui.elements.AbstractGUIElement
NO_DESIRED_SLOT -
Constructor Summary
ConstructorsConstructorDescriptionInputSlot(String uniqueInputSlotID, int slot, InputSlot.ActionHandler actionHandler) Construct a new InputSlotInputSlot(String uniqueInputSlotID, InputSlot.ActionHandler actionHandler) Construct a new InputSlot -
Method Summary
Modifier and TypeMethodDescriptionbooleancanAutoInsertIntoSlot(org.bukkit.entity.Player viewer, GUISession session) Whether or not viewers can use Minecraft's auto-insert (Shift click) feature with this slot.Get the ActionHandler that defines how this InputSlot behavesorg.bukkit.inventory.ItemStackgetCurrentItem(GUIState guiState) Get the item currently being displayed in this input slotorg.bukkit.inventory.ItemStackgetDisplay(org.bukkit.entity.Player viewer, GUISession session) This method returns the item (Bukkit) to be displayed in the inventory slot for a player.getFormImage(org.bukkit.entity.Player viewer, GUISession session) This method returns the Form Image (Bedrock) to be displayed in the GUI for a player.Get the unique (Within this GUI) input slot ID for this input slot.voidThis method defines the behaviour of this GUIElement.voidsetActionHandler(InputSlot.ActionHandler actionHandler) Set the ActionHandler that defines how this InputSlot behavesvoidsetCurrentItem(GUISession guiSession, org.bukkit.inventory.ItemStack item) Set the item currently being displayed in this input slot.voidsetInputSlotID(String inputSlotID) Set the unique (Within this GUI) input slot ID for this input slot.Methods inherited from class me.eddie.inventoryguiapi.gui.elements.AbstractGUIElement
getDesiredDisplayPosition, hasDesiredDisplayPosition, setDesiredDisplayPosition, setHasDesiredDisplayPosition
-
Constructor Details
-
InputSlot
Construct a new InputSlot- Parameters:
uniqueInputSlotID- The unique (Within this GUI) input slot ID for this input slot. Used to track what item is currently contained within this input slot.slot- The desired slot for this GUIElementactionHandler- The action handler that defines how this input slot should behave when interacted with
-
InputSlot
Construct a new InputSlot- Parameters:
uniqueInputSlotID- The unique (Within this GUI) input slot ID for this input slot. Used to track what item is currently contained within this input slot.actionHandler- The action handler that defines how this input slot should behave when interacted with
-
-
Method Details
-
getInputSlotID
Get the unique (Within this GUI) input slot ID for this input slot. Used to track what item is currently contained within this input slot.- Returns:
- The input slot ID.
-
setInputSlotID
Set the unique (Within this GUI) input slot ID for this input slot. Used to track what item is currently contained within this input slot.- Parameters:
inputSlotID- The input slot ID
-
getActionHandler
Get the ActionHandler that defines how this InputSlot behaves- Returns:
- The ActionHandler
-
setActionHandler
Set the ActionHandler that defines how this InputSlot behaves- Parameters:
actionHandler- The ActionHandler
-
getCurrentItem
Get the item currently being displayed in this input slot- Parameters:
guiState- The GUIState that this InputSlot belongs to- Returns:
- The ItemStack currently being displayed
-
setCurrentItem
Set the item currently being displayed in this input slot. Note this does NOT update the inventory being displayed, to update the inventory being displayed it will need it's contents refreshing (However if called within a GUIContentsProvider refresh is called for you)- Parameters:
guiSession- The GUISession that is being updateditem- The ItemStack currently being displayed
-
onEvent
Description copied from interface:GUIElementThis method defines the behaviour of this GUIElement. Implementations should handle the event appropriately for the element's behaviour (Including cancelling the bukkit event responsible for the GUIEvent when necessary). GUIElements will only ever receive events that interact with them, eg. click, place and pickup events. This happens in response to an Inventory event, so don't do anything during this call that the Bukkit API docs don't recommend doing at this time.- Parameters:
event- The GUIEvent to handle
-
getDisplay
public org.bukkit.inventory.ItemStack getDisplay(org.bukkit.entity.Player viewer, GUISession session) Description copied from interface:GUIElementThis method returns the item (Bukkit) to be displayed in the inventory slot for a player. A returned value of null or an item of type AIR denotes that this slot in the inventory should be empty.- Parameters:
viewer- The player viewing the inventory. In the case of SharedGUI's the viewer should be ignored.session- The GUISession that this GUIElement is being used with- Returns:
- The itemstack to display to the viewer
-
getFormImage
Description copied from interface:GUIElementThis method returns the Form Image (Bedrock) to be displayed in the GUI for a player.- Parameters:
viewer- The player viewing the inventory. In the case of SharedGUI's the viewer should be ignored.session- The GUISession that this GUIElement is being used with- Returns:
- The form image type to display to the viewer
-
canAutoInsertIntoSlot
Description copied from interface:GUIElementWhether or not viewers can use Minecraft's auto-insert (Shift click) feature with this slot. If they can then shift-clicking will be able to target this slot. Shift click events won't be passed directly to the GUIElement though, they are instead turned into pickup and place events and those are passed to GUIElements as appropriate.- Parameters:
viewer- The viewer trying to auto insert into the slotsession- The GUISession trying to auto insert into the slot- Returns:
- True if auto-insert is enabled and False if not
-