Class IntelligentItem

java.lang.Object
io.github.rysefoxx.inventory.plugin.content.IntelligentItem

public class IntelligentItem extends Object
Since:
2/18/2022
  • Constructor Details

    • IntelligentItem

      @Contract(pure=true) public IntelligentItem(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer, IntelligentItemError error)
  • Method Details

    • of

      @Contract(value="_, _, _ -> new", pure=true) @NotNull public static @NotNull IntelligentItem of(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull @NotNull IntelligentItemError error, @NotNull @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer)
      Parameters:
      itemStack - The item stack that will be used to create the intelligent item.
      error - The error that will be displayed if the player doesn't have the required permission.
      eventConsumer - The consumer that will be called when the item is clicked.
      Returns:
      A new instance of IntelligentItem
    • of

      @Contract(value="_, _ -> new", pure=true) @NotNull public static @NotNull IntelligentItem of(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer)
      Parameters:
      itemStack - The item that will be displayed in the inventory.
      eventConsumer - The consumer that will be called when the item is clicked.
      Returns:
      A new instance of IntelligentItem
    • empty

      @Contract(value="_ -> new", pure=true) @NotNull public static @NotNull IntelligentItem empty(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      This function returns a new IntelligentItem with no actions.
      Parameters:
      itemStack - The itemstack that will be used for the item.
      Returns:
      A new IntelligentItem object.
    • empty

      @Contract(value="_, _ -> new", pure=true) @NotNull public static @NotNull IntelligentItem empty(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull @NotNull IntelligentItemError error)
      This function returns an IntelligentItem that does nothing when clicked. And displays an error when the given condition does not apply.
      Parameters:
      itemStack - The itemstack that will be used to create the IntelligentItem.
      error - The error when the given condition does not apply.
      Returns:
      A new instance of IntelligentItem
    • ignored

      @Contract(value="_ -> new", pure=true) @NotNull public static @NotNull IntelligentItem ignored(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack)
      This function takes an ItemStack and returns an IntelligentItem that is ignored. This allows the player who has the inventory open to take the item out.
      Parameters:
      itemStack - The item to be ignored.
      Returns:
      A new IntelligentItem object.
    • ignored

      @Contract(value="_, _ -> new", pure=true) @NotNull public static @NotNull IntelligentItem ignored(@NotNull @NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull @NotNull IntelligentItemError error)
      This function takes an ItemStack and returns an IntelligentItem that is ignored. This allows the player who has the inventory open to take the item out.
      Parameters:
      itemStack - The item stack that is being ignored.
      error - The error when the given condition does not apply.
      Returns:
      A new instance of the IntelligentItem class.
    • clearConsumer

      public void clearConsumer()
      Removes the consumer from an IntelligentItem
    • identifier

      @NotNull public @NotNull IntelligentItem identifier(@NotNull @NotNull Object id, @NotNull @NotNull InventoryManager manager)
      Sets the id of an IntelligentItem
      Parameters:
      id - The id of the item
      manager - The manager that will be used to update the inventory.
      Returns:
      The IntelligentItem object.
    • canClick

      @NotNull public @NotNull IntelligentItem canClick(@NotNull @NotNull BooleanSupplier supplier)
      Checks if the item can be clicked.
      Parameters:
      supplier - The supplier to check.
      Returns:
      The IntelligentItem.
    • canSee

      @NotNull public @NotNull IntelligentItem canSee(@NotNull @NotNull BooleanSupplier supplier)
      Checks if the item is visible to the player.
      Parameters:
      supplier - The supplier to check.
      Returns:
      The IntelligentItem.
    • update

      @NotNull public @NotNull IntelligentItem update(@NotNull @NotNull org.bukkit.inventory.ItemStack newItemStack)
      Changes the ItemStack of an existing ItemStack without changing the consumer.
      Parameters:
      newItemStack - The new ItemStack
      Returns:
      The new intelligent ItemStack
    • update

      @NotNull public @NotNull IntelligentItem update(@NotNull @NotNull IntelligentItem newIntelligentItem)
      Changes the ItemStack of an existing Intelligent with changing the consumer.
      Parameters:
      newIntelligentItem - The new IntelligentItem
      Returns:
      The new intelligent ItemStack
    • serialize

      @NotNull public @NotNull Map<String,Object> serialize()
      Serializes the IntelligentItem to a map.
      Returns:
      The serialized map.
      See Also:
    • deserialize

      @Nullable public static @Nullable IntelligentItem deserialize(@NotNull @NotNull Map<String,Object> map)
      Deserializes a map to an IntelligentItem.
      Parameters:
      map - The map to deserialize.
      Returns:
      The deserialized IntelligentItem.
    • equals

      @Contract(value="null -> false", pure=true) public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object