Package xyz.srnyx.annoyingapi.data
Class ItemData
- java.lang.Object
-
- xyz.srnyx.javautilities.parents.Stringable
-
- xyz.srnyx.annoyingapi.data.Data<org.bukkit.inventory.ItemStack>
-
- xyz.srnyx.annoyingapi.data.ItemData
-
-
Constructor Summary
Constructors Constructor Description ItemData(@NotNull AnnoyingPlugin plugin, @NotNull org.bukkit.inventory.ItemStack item)Construct a newItemDatafor the given item stack
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidattemptItemNbtApi(@NotNull java.lang.Runnable runnable)If theRuntimeLibrary.ITEM_NBT_APIlibrary isn't loaded, load it.@NotNull java.util.Optional<java.lang.String>attemptItemNbtApi(@NotNull java.util.function.Supplier<java.lang.String> supplier)If theRuntimeLibrary.ITEM_NBT_APIlibrary isn't loaded, load it.@Nullable java.lang.Stringget(@NotNull java.lang.String key)Get the data value for the given keybooleanremove(@NotNull java.lang.String key)Remove the data value with the given keyprotected booleanset(@NotNull java.lang.String key, @NotNull java.lang.String value)Set the data value for the given key.-
Methods inherited from class xyz.srnyx.annoyingapi.data.Data
get, getAnnoyingPlugin, getOptional, has, removeChain, sendError, set, setChain
-
-
-
-
Constructor Detail
-
ItemData
public ItemData(@NotNull @NotNull AnnoyingPlugin plugin, @NotNull @NotNull org.bukkit.inventory.ItemStack item)Construct a newItemDatafor the given item stack- Parameters:
plugin-Data.pluginitem-Data.target
-
-
Method Detail
-
attemptItemNbtApi
@NotNull public @NotNull java.util.Optional<java.lang.String> attemptItemNbtApi(@NotNull @NotNull java.util.function.Supplier<java.lang.String> supplier)If theRuntimeLibrary.ITEM_NBT_APIlibrary isn't loaded, load it. Then attempt to run the given supplier and return the result- Parameters:
supplier- the supplier to attempt- Returns:
- the result of the runnable
-
attemptItemNbtApi
public void attemptItemNbtApi(@NotNull @NotNull java.lang.Runnable runnable)If theRuntimeLibrary.ITEM_NBT_APIlibrary isn't loaded, load it. Then attempt to run the given runnable- Parameters:
runnable- the runnable to attempt
-
get
@Nullable public @Nullable java.lang.String get(@NotNull @NotNull java.lang.String key)Get the data value for the given key
-
set
protected boolean set(@NotNull @NotNull java.lang.String key, @NotNull @NotNull java.lang.String value)Set the data value for the given key. If the key already exists, it will be overwritten
-
-