Class NBT_Persistent
java.lang.Object
me.deecaad.core.compatibility.nbt.NBT_Persistent
- All Implemented Interfaces:
NBTCompatibility
Due to class loading issues, this logic (that was originally implemented in
NBTCompatibility) is now implemented here. This way, on 1.12.2,
PersistentDataType is not loaded.-
Field Summary
Fields inherited from interface me.deecaad.core.compatibility.nbt.NBTCompatibility
DO_NOT_MODIFY_ME, DO_NOT_MODIFY_ME_STRING -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint[]getArray(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, int[] def) Returns the int[] value of a NBT tag with the given namekey.doublegetDouble(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, double def) Returns theDoublevalue of a NBT tag with the given namekey.intgetInt(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, int def) Returns theIntegervalue of a NBT tag with the given namekey.getString(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, String def) Returns theStringvalue of a NBT tag with the given namekey.String[]getStringArray(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, String[] def) Returns theString[] value of a NBT tag with the given namekey.booleanhasArray(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key) Returnstrueif the givenbukkitItem's NBT compound has the givenkey, and it is an int[] value.booleanhasDouble(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key) booleanhasInt(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key) booleanhasString(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key) booleanhasStringArray(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key) voidremove(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key) Removes the given NBT tag from the item.voidsetArray(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, int[] value) Sets the int[] value of a NBT tag with the given namekey.voidsetDouble(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, double value) Sets theDoublevalue of a NBT tag with the given namekey.voidsetInt(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, int value) Sets theIntegervalue of a NBT tag with the given namekey.voidsetString(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, String value) Sets theStringvalue of a NBT tag with the given namekey.voidsetStringArray(@NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull String plugin, @NotNull String key, String[] value) Sets theDoublevalue of a NBT tag with the given namekey.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface me.deecaad.core.compatibility.nbt.NBTCompatibility
getArray, getDouble, getInt, getKey, getNBTDebug, getString, getStringArray
-
Constructor Details
-
NBT_Persistent
public NBT_Persistent()
-
-
Method Details
-
hasString
public boolean hasString(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key) Description copied from interface:NBTCompatibilityReturnstrueif the givenbukkitItem's NBT compound has the givenkey, and it is aStringvalue. Otherwise, this method will returnnull.- Specified by:
hasStringin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to check existence of.- Returns:
trueif the NBT compound uses the tag.
-
getString
public String getString(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, String def) Description copied from interface:NBTCompatibilityReturns theStringvalue of a NBT tag with the given namekey. The value is pulled from an NBT compound contained in the given itembukkitItem. If the tag isn't used in the item's compound, then this method will returndef.- Specified by:
getStringin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to pull some value from.def- The default value to return if the key is not present.- Returns:
- The value of the tag, or
null.
-
setString
public void setString(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, String value) Description copied from interface:NBTCompatibilitySets theStringvalue of a NBT tag with the given namekey. The value is put in the NBT compound stored in the given itembukkitItem.The stored value can be seen using
NBTCompatibility.getString(ItemStack, String, String).- Specified by:
setStringin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to store the value at.value- The value that will be stored.
-
hasInt
public boolean hasInt(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key) Description copied from interface:NBTCompatibilityReturnstrueif the givenbukkitItem's NBT compound has the givenkey, and it is anIntegervalue. Otherwise, this method will returnnull.- Specified by:
hasIntin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to check existence of.- Returns:
trueif the NBT compound uses the tag.
-
getInt
public int getInt(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, int def) Description copied from interface:NBTCompatibilityReturns theIntegervalue of a NBT tag with the given namekey. The value is pulled from an NBT compound contained in the given itembukkitItem. If the tag isn't used in the item's compound, then this method will returndef.- Specified by:
getIntin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to pull some value from.def- The default value to return if the key is not present.- Returns:
- The value of the tag, or
0.
-
setInt
public void setInt(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, int value) Description copied from interface:NBTCompatibilitySets theIntegervalue of a NBT tag with the given namekey. The value is put in the NBT compound stored in the given itembukkitItem.The stored value can be seen using
NBTCompatibility.getInt(ItemStack, String, String).- Specified by:
setIntin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to store the value at.value- The value that will be stored.
-
hasDouble
public boolean hasDouble(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key) Description copied from interface:NBTCompatibilityReturnstrueif the givenbukkitItem's NBT compound has the givenkey, and it is aDoublevalue. Otherwise, this method will returnnull.- Specified by:
hasDoublein interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to check existence of.- Returns:
trueif the NBT compound uses the tag.
-
getDouble
public double getDouble(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, double def) Description copied from interface:NBTCompatibilityReturns theDoublevalue of a NBT tag with the given namekey. The value is pulled from an NBT compound contained in the given itembukkitItem. If the tag isn't used in the item's compound, then this method will returndef.- Specified by:
getDoublein interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to pull some value from.def- The default value to return if the key is not present.- Returns:
- The value of the tag, or
0.
-
setDouble
public void setDouble(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, double value) Description copied from interface:NBTCompatibilitySets theDoublevalue of a NBT tag with the given namekey. The value is put in a compound according to the givenplugin, inside of thebukkitItemNBT compound.The stored value can be seen using
NBTCompatibility.getDouble(ItemStack, String, String).- Specified by:
setDoublein interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to store the value at.value- The value that will be stored.
-
hasArray
public boolean hasArray(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key) Description copied from interface:NBTCompatibilityReturnstrueif the givenbukkitItem's NBT compound has the givenkey, and it is an int[] value. Otherwise, this method will returnnull.- Specified by:
hasArrayin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to check existence of.- Returns:
trueif the NBT compound uses the tag.
-
getArray
public int[] getArray(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, int[] def) Description copied from interface:NBTCompatibilityReturns the int[] value of a NBT tag with the given namekey. The value is pulled from an NBT compound contained in the given itembukkitItem. If the tag isn't used in the item's compound, then this method will returndef.- Specified by:
getArrayin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to pull some value from.def- The default value to return if the key is not present.- Returns:
- The value of the tag, or
def.
-
setArray
public void setArray(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, int[] value) Description copied from interface:NBTCompatibilitySets the int[] value of a NBT tag with the given namekey. The value is put in a compound according to the givenplugin, inside of thebukkitItemNBT compound.The stored value can be seen using
NBTCompatibility.getArray(ItemStack, String, String).- Specified by:
setArrayin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to store the value at.value- The value that will be stored.
-
hasStringArray
public boolean hasStringArray(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key) Description copied from interface:NBTCompatibilityReturnstrueif the givenbukkitItem's NBT compound has the givenkey, and it is aString[] value. Otherwise, this method will returnnull.- Specified by:
hasStringArrayin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to check existence of.- Returns:
trueif the NBT compound uses the tag.
-
getStringArray
public String[] getStringArray(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, String[] def) Description copied from interface:NBTCompatibilityReturns theString[] value of a NBT tag with the given namekey. The value is pulled from an NBT compound contained in the given itembukkitItem. If the tag isn't used in the item's compound, then this method will returndef.- Specified by:
getStringArrayin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to pull some value from.def- The default value to return if the key is not present.- Returns:
- The value of the tag, or
def.
-
setStringArray
public void setStringArray(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key, String[] value) Description copied from interface:NBTCompatibilitySets theDoublevalue of a NBT tag with the given namekey. The value is put in a compound according to the givenplugin, inside of thebukkitItemNBT compound.The stored value can be seen using
NBTCompatibility.getStringArray(ItemStack, String, String).- Specified by:
setStringArrayin interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to store the value at.value- The value that will be stored.
-
remove
public void remove(@NotNull @NotNull org.bukkit.inventory.ItemStack bukkitItem, @NotNull @NotNull String plugin, @NotNull @NotNull String key) Description copied from interface:NBTCompatibilityRemoves the given NBT tag from the item. To check to see if there was a key to delete, useNBTCompatibility.hasString(ItemStack, String, String)(or one of thehasXmethods).- Specified by:
removein interfaceNBTCompatibility- Parameters:
bukkitItem- The non-null item that has an NBT tag compound.plugin- The non-null owner of the tag, should be your plugin.key- The non-null name of the tag to remove.
-