Class IntelligentItem
java.lang.Object
io.github.rysefoxx.inventory.plugin.content.IntelligentItem
- Since:
- 2/18/2022
-
Constructor Summary
ConstructorsConstructorDescriptionIntelligentItem(@NotNull org.bukkit.inventory.ItemStack itemStack, Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer, IntelligentItemError error) -
Method Summary
Modifier and TypeMethodDescription@NotNull IntelligentItemcanClick(@NotNull BooleanSupplier supplier) Checks if the item can be clicked.@NotNull IntelligentItemcanSee(@NotNull BooleanSupplier supplier) Checks if the item is visible to the player.voidRemoves the consumer from an IntelligentItemstatic @Nullable IntelligentItemdeserialize(@NotNull Map<String, Object> map) Deserializes a map to an IntelligentItem.static @NotNull IntelligentItemempty(@NotNull org.bukkit.inventory.ItemStack itemStack) This function returns a new IntelligentItem with no actions.static @NotNull IntelligentItemempty(@NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull IntelligentItemError error) This function returns an IntelligentItem that does nothing when clicked.booleaninthashCode()@NotNull IntelligentItemidentifier(@NotNull Object id, @NotNull InventoryManager manager) Sets the id of an IntelligentItemstatic @NotNull IntelligentItemignored(@NotNull org.bukkit.inventory.ItemStack itemStack) This function takes an ItemStack and returns an IntelligentItem that is ignored.static @NotNull IntelligentItemignored(@NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull IntelligentItemError error) This function takes an ItemStack and returns an IntelligentItem that is ignored.static @NotNull IntelligentItemof(@NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull IntelligentItemError error, @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer) static @NotNull IntelligentItemof(@NotNull org.bukkit.inventory.ItemStack itemStack, @NotNull Consumer<org.bukkit.event.inventory.InventoryClickEvent> eventConsumer) Serializes the IntelligentItem to a map.@NotNull IntelligentItemupdate(@NotNull IntelligentItem newIntelligentItem) Changes the ItemStack of an existing Intelligent with changing the consumer.@NotNull IntelligentItemupdate(@NotNull org.bukkit.inventory.ItemStack newItemStack) Changes the ItemStack of an existing ItemStack without changing the consumer.
-
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 itemmanager- The manager that will be used to update the inventory.- Returns:
- The IntelligentItem object.
-
canClick
Checks if the item can be clicked.- Parameters:
supplier- The supplier to check.- Returns:
- The IntelligentItem.
-
canSee
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
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
-
hashCode
public int hashCode()
-