Class GuiItem
java.lang.Object
com.github.cyberryan1.cybercore.spigot.gui.GuiItem
Represents an item in the
Gui
class. Contains information about
the item, the slot in the GUI, and the lambda statement (if any) to run when
this item is clicked by the player.-
Constructor Summary
ConstructorsConstructorDescriptionGuiItem
(org.bukkit.inventory.ItemStack item, int slot) GuiItem
(org.bukkit.inventory.ItemStack item, int slot, GuiClickEvent clickEvent) GuiItem
(org.bukkit.Material material, String name, int slot, GuiClickEvent clickEvent) -
Method Summary
Modifier and TypeMethodDescriptionvoid
execute()
Runs the lambda statement through theGuiClickEvent
Returns the lambda statement (no arg) currently being used when the item is clickedorg.bukkit.inventory.ItemStack
getItem()
Returns the item this currently representsint
getSlot()
Returns the current slot this item will be placed in the GUIorg.bukkit.Material
getType()
Returns the type of the item this representsboolean
Returns if the item currently runs some other code when it is clicked or if it will do nothingvoid
setExecuteOnClick
(GuiClickEvent clickEvent) Sets what lambda statement that is run when the item is clickedvoid
setItem
(org.bukkit.inventory.ItemStack item) Sets theItemStack
for this itemvoid
Sets the item using aMaterial
and namevoid
setItemAmount
(int amount) Sets the amount of the item in the GUIvoid
setSlot
(int slot) Sets a new slot in the GUI
-
Constructor Details
-
GuiItem
-
GuiItem
-
GuiItem
public GuiItem(org.bukkit.inventory.ItemStack item, int slot) -
GuiItem
-
-
Method Details
-
setItem
public void setItem(org.bukkit.inventory.ItemStack item) Sets theItemStack
for this item- Parameters:
item
- New itemstack
-
setItem
Sets the item using aMaterial
and name- Parameters:
material
- New materialname
- New name
-
setSlot
public void setSlot(int slot) Sets a new slot in the GUI- Parameters:
slot
- New slot
-
setItemAmount
public void setItemAmount(int amount) Sets the amount of the item in the GUI- Parameters:
amount
- New amount
-
setExecuteOnClick
Sets what lambda statement that is run when the item is clicked- Parameters:
clickEvent
- New lambda statement throughGuiClickEvent
-
getItem
public org.bukkit.inventory.ItemStack getItem()Returns the item this currently represents- Returns:
ItemStack
currently represented
-
getType
public org.bukkit.Material getType()Returns the type of the item this represents- Returns:
Material
used for this item
-
getSlot
public int getSlot()Returns the current slot this item will be placed in the GUI- Returns:
- slot in GUI
-
getClickEvent
Returns the lambda statement (no arg) currently being used when the item is clicked- Returns:
GuiClickEvent
ran when clicked
-
isExecutable
public boolean isExecutable()Returns if the item currently runs some other code when it is clicked or if it will do nothing- Returns:
- true if it will run something when clicked, false if not
-
execute
public void execute()Runs the lambda statement through theGuiClickEvent
- Throws:
NullPointerException
- if the item has no lambda statements to run
-