Package com.marcusslover.plus.lib.common
Class Taggable<V extends IMetaContainer<V,P>,P extends org.bukkit.persistence.PersistentDataHolder>
java.lang.Object
com.marcusslover.plus.lib.common.Taggable<V,P>
- All Implemented Interfaces:
IMetaContainer<Item,org.bukkit.inventory.meta.ItemMeta>
- Direct Known Subclasses:
Item
public abstract class Taggable<V extends IMetaContainer<V,P>,P extends org.bukkit.persistence.PersistentDataHolder>
extends Object
implements IMetaContainer<Item,org.bukkit.inventory.meta.ItemMeta>
-
Constructor Details
-
Taggable
public Taggable()
-
-
Method Details
-
holder
-
tagHolder
-
hasTag
public boolean hasTag(@NotNull @NotNull String key, @NotNull @NotNull org.bukkit.persistence.PersistentDataType<?, ?> type) Check if the item has a tag with the given key.- Parameters:
key- The key of the tag.type- The type of the tag.- Returns:
- True if the item has the tag, false otherwise.
-
tag
-
setTag
@NotNull public <K,Z> V setTag(@NotNull @NotNull String key, @NotNull Z value, @NotNull @NotNull org.bukkit.persistence.PersistentDataType<K, Z> type) Set a tag to the item.- Type Parameters:
K- The type of the value.- Parameters:
key- The key of the tag.value- The value of the tag.type- The type of the value. You can useDataTypefor all the default types.- Returns:
- The holder.
-
tag
-
removeTag
Remove the tag with the given key.- Parameters:
key- The key of the tag.- Returns:
- The holder.
-
getTag
@NotNull public <K,Z> @NotNull Optional<Z> getTag(@NotNull @NotNull String key, @NotNull @NotNull org.bukkit.persistence.PersistentDataType<K, Z> type) Get the value of the tag with the given key.- Type Parameters:
K- The type of the value.- Parameters:
key- The key of the tag.type- The type of the value. You can useDataTypefor all the default types.- Returns:
- The optional value of the tag. If the item doesn't have the tag, the optional will be empty.
-