java.lang.Object
com.github.cyberryan1.cybercore.spigot.gui.GuiItem

public class GuiItem extends Object
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

    Constructors
    Constructor
    Description
    GuiItem(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)
     
    GuiItem(org.bukkit.Material material, String name, int slot, GuiClickEvent clickEvent)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Runs the lambda statement through the GuiClickEvent
    Returns the lambda statement (no arg) currently being used when the item is clicked
    org.bukkit.inventory.ItemStack
    Returns the item this currently represents
    int
    Returns the current slot this item will be placed in the GUI
    org.bukkit.Material
    Returns the type of the item this represents
    boolean
    Returns if the item currently runs some other code when it is clicked or if it will do nothing
    void
    Sets what lambda statement that is run when the item is clicked
    void
    setItem(org.bukkit.inventory.ItemStack item)
    Sets the ItemStack for this item
    void
    setItem(org.bukkit.Material material, String name)
    Sets the item using a Material and name
    void
    setItemAmount(int amount)
    Sets the amount of the item in the GUI
    void
    setSlot(int slot)
    Sets a new slot in the GUI

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GuiItem

      public GuiItem(org.bukkit.Material material, String name, int slot)
    • GuiItem

      public GuiItem(org.bukkit.Material material, String name, int slot, GuiClickEvent clickEvent)
    • GuiItem

      public GuiItem(org.bukkit.inventory.ItemStack item, int slot)
    • GuiItem

      public GuiItem(org.bukkit.inventory.ItemStack item, int slot, GuiClickEvent clickEvent)
  • Method Details

    • setItem

      public void setItem(org.bukkit.inventory.ItemStack item)
      Sets the ItemStack for this item
      Parameters:
      item - New itemstack
    • setItem

      public void setItem(org.bukkit.Material material, String name)
      Sets the item using a Material and name
      Parameters:
      material - New material
      name - 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

      public void setExecuteOnClick(GuiClickEvent clickEvent)
      Sets what lambda statement that is run when the item is clicked
      Parameters:
      clickEvent - New lambda statement through GuiClickEvent
    • 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

      public GuiClickEvent 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 the GuiClickEvent
      Throws:
      NullPointerException - if the item has no lambda statements to run