Class GuiItem

java.lang.Object
me.despical.inventoryframework.GuiItem

public class GuiItem extends Object
An item for in an inventory
Since:
1.0.1

Created at 04.09.2020

Author:
Despical
  • Constructor Summary

    Constructors
    Constructor
    Description
    GuiItem(@NotNull org.bukkit.inventory.ItemStack item)
    Creates a new gui item based on the item stack and action
    GuiItem(@NotNull org.bukkit.inventory.ItemStack item, @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> action)
    Creates a new gui item based on the item stack and action
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent>
    Returns the action for this item
    @NotNull org.bukkit.inventory.ItemStack
    Returns the item
    @NotNull UUID
    Gets the UUID associated with this GuiItem.
    boolean
    Returns whether or not this item is visible
    static GuiItem
    of(@NotNull org.bukkit.inventory.ItemStack itemStack)
     
    static GuiItem
    of(@NotNull org.bukkit.inventory.ItemStack itemStack, @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> action)
     
    void
    setVisible(boolean visible)
    Sets the visibility of this item to the new visibility

    Methods inherited from class java.lang.Object

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

    • GuiItem

      public GuiItem(@NotNull @NotNull org.bukkit.inventory.ItemStack item, @Nullable @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> action)
      Creates a new gui item based on the item stack and action
      Parameters:
      item - the item stack
      action - the action called whenever an interaction with this item happens
    • GuiItem

      public GuiItem(@NotNull @NotNull org.bukkit.inventory.ItemStack item)
      Creates a new gui item based on the item stack and action
      Parameters:
      item - the item stack
  • Method Details

    • of

      public static GuiItem of(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
    • of

      public static GuiItem of(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, @Nullable @Nullable Consumer<org.bukkit.event.inventory.InventoryClickEvent> action)
    • getAction

      @NotNull @Contract(pure=true) public @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> getAction()
      Returns the action for this item
      Returns:
      the action called when clicked on this item
    • getItem

      @NotNull @Contract(pure=true) public @NotNull org.bukkit.inventory.ItemStack getItem()
      Returns the item
      Returns:
      the item that belongs to this gui item
    • getUUID

      @NotNull @Contract(pure=true) public @NotNull UUID getUUID()
      Gets the UUID associated with this GuiItem. This is for internal use only, and should not be used.
      Returns:
      the UUID of this item
      Since:
      1.0.1
    • isVisible

      public boolean isVisible()
      Returns whether or not this item is visible
      Returns:
      true if this item is visible, false otherwise
    • setVisible

      public void setVisible(boolean visible)
      Sets the visibility of this item to the new visibility
      Parameters:
      visible - the new visibility