public interface ReadableNBT
Modifier and Type | Method and Description |
---|---|
<T> T |
get(String key,
NBTHandler<T> handler)
Get the object at the specified key via the handler.
|
Boolean |
getBoolean(String key)
Returns the value associated with the given key, or false if the key is not
found.
|
Byte |
getByte(String key)
Get the value of the given key as a byte, or 0 if the key is not found.
|
byte[] |
getByteArray(String key)
Returns the value associated with the given key as a byte array, or null if
the key is not found.
|
ReadableNBT |
getCompound(String name) |
ReadableNBTList<ReadWriteNBT> |
getCompoundList(String name) |
Double |
getDouble(String key)
Returns the value associated with the given key as a double, or false of not
found.
|
ReadableNBTList<Double> |
getDoubleList(String name) |
<E extends Enum<E>> |
getEnum(String key,
Class<E> type)
Get an Enum value that has been set via setEnum or setString(key,
value.name()).
|
Float |
getFloat(String key)
Returns the value of the given key as a Float, or 0 if the key does not
exist.
|
ReadableNBTList<Float> |
getFloatList(String name) |
int[] |
getIntArray(String key)
Returns the value associated with the given key as an array of integers, or
null if the key does not exist.
|
ReadableNBTList<int[]> |
getIntArrayList(String name) |
Integer |
getInteger(String key)
Given a key, return the value associated with that key as an Integer, or 0 if
the key is not found.
|
ReadableNBTList<Integer> |
getIntegerList(String name) |
org.bukkit.inventory.ItemStack |
getItemStack(String key)
It returns an ItemStack associated with the given key, or null if the key
does not exist.
|
org.bukkit.inventory.ItemStack[] |
getItemStackArray(String key)
Get an
ItemStack array that was saved at the given key, or null if no
stored data was found |
Set<String> |
getKeys() |
NBTType |
getListType(String name)
Returns the type of the list, null if not a list
|
Long |
getLong(String key)
Returns the value associated with the given key as a Long, or 0 if the key is
not found.
|
long[] |
getLongArray(String key)
Returns the value associated with the given key as an array of longs, or null
if the key does not exist.
|
ReadableNBTList<Long> |
getLongList(String name) |
<T> T |
getOrDefault(String key,
T defaultValue)
Returns the stored value if exists, or provided value otherwise.
|
<T> T |
getOrNull(String key,
Class<?> type)
Returns the stored value if exists, or null.
|
Short |
getShort(String key)
Returns the value of the key as a Short, or 0 if the key is not found.
|
String |
getString(String key)
Given a key, return the value associated with that key.
|
ReadableNBTList<String> |
getStringList(String name) |
NBTType |
getType(String name) |
UUID |
getUUID(String key)
Given a key, return the UUID of the key.
|
ReadableNBTList<UUID> |
getUUIDList(String name) |
boolean |
hasTag(String key)
Checks whether the provided key exists
|
default boolean |
hasTag(String key,
NBTType type)
Checks whether the provided key exists and has the specified type
|
ReadableNBT |
resolveCompound(String key)
Returns the resolved Compound if exists, or null.
|
<T> T |
resolveOrDefault(String key,
T defaultValue)
Returns the resolved value if exists, or provided value otherwise.
|
<T> T |
resolveOrNull(String key,
Class<?> type)
Returns the resolved value if exists, or null.
|
String |
toString() |
void |
writeCompound(OutputStream stream)
Write the content of this Compound into the provided stream.
|
String getString(String key)
key
- The key to get the value for.Integer getInteger(String key)
key
- The key to look up in the properties file.Double getDouble(String key)
key
- The key of the preference to retrieve.Byte getByte(String key)
key
- The key to get the value for.Short getShort(String key)
key
- The key of the value you want to get.Long getLong(String key)
key
- The key of the value you want to get.Float getFloat(String key)
key
- The key of the preference to retrieve.@Nullable byte[] getByteArray(String key)
key
- The key to use to retrieve the value.@Nullable int[] getIntArray(String key)
key
- The key of the value you want to get.@Nullable long[] getLongArray(String key)
key
- The key of the value you want to get.Boolean getBoolean(String key)
key
- The key of the preference to retrieve.@Nullable org.bukkit.inventory.ItemStack getItemStack(String key)
key
- The key of the itemstack you want to get.@Nullable org.bukkit.inventory.ItemStack[] getItemStackArray(String key)
ItemStack
array that was saved at the given key, or null if no
stored data was foundkey
- keyItemStack
array, or null if stored data wasn't
found@Nullable UUID getUUID(String key)
key
- The key to get the value fromboolean hasTag(String key)
key
- String keydefault boolean hasTag(String key, NBTType type)
key
- String keytype
- nbt tag type@Nullable ReadableNBT getCompound(String name)
name
- ReadableNBTList<String> getStringList(String name)
name
- ReadableNBTList<Integer> getIntegerList(String name)
name
- ReadableNBTList<int[]> getIntArrayList(String name)
name
- ReadableNBTList<UUID> getUUIDList(String name)
name
- ReadableNBTList<Float> getFloatList(String name)
name
- ReadableNBTList<Double> getDoubleList(String name)
name
- ReadableNBTList<Long> getLongList(String name)
name
- @Nullable NBTType getListType(String name)
name
- ReadableNBTList<ReadWriteNBT> getCompoundList(String name)
name
- <T> T getOrDefault(String key, T defaultValue)
Supported types:
Boolean, Byte, Short, Integer, Long, Float, Double, byte[], int[], long[]
,
String
, UUID
, and Enum
T
- value typekey
- keydefaultValue
- default non-null value@Nullable <T> T getOrNull(String key, Class<?> type)
Supported types:
Boolean, Byte, Short, Integer, Long, Float, Double, byte[], int[], long[]
,
String
, UUID
, and Enum
T
- value typekey
- keytype
- data type@Nullable <T> T resolveOrNull(String key, Class<?> type)
Supported types:
Boolean, Byte, Short, Integer, Long, Float, Double, byte[], int[], long[]
,
String
, UUID
, and Enum
T
- value typekey
- Path key, seperated by '.'. For example: "foo.bar.baz". Dots can
be escaped with a backslash.type
- data type<T> T resolveOrDefault(String key, T defaultValue)
Supported types:
Boolean, Byte, Short, Integer, Long, Float, Double, byte[], int[], long[]
,
String
, UUID
, and Enum
T
- value typekey
- Path key, seperated by '.'. For example: "foo.bar.baz".
Dots can be escaped with a backslash.defaultValue
- default non-null value@Nullable ReadableNBT resolveCompound(String key)
key
- Path key, seperated by '.'. For example: "foo.bar.baz". Dots can
be escaped with a backslash.<T> T get(String key, NBTHandler<T> handler)
T
- key
- handler
- @Nullable <E extends Enum<E>> E getEnum(String key, Class<E> type)
E
- key
- type
- NBTType getType(String name)
name
- void writeCompound(OutputStream stream)
stream
- Copyright © 2015–2024 tr7zw. All rights reserved.