Package net.kyori.adventure.nbt.api
Interface BinaryTagHolder
-
public interface BinaryTagHolder
Holds a compound binary tag.Instead of including an entire NBT implementation in Adventure, it was decided to use this "holder" interface instead. This opens the door for platform specific implementations.
See
net.kyori.adventure.nbt.impl
for a platform agnostic implementation.- Since:
- 4.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method Description static @NotNull BinaryTagHolder
binaryTagHolder(@NotNull java.lang.String string)
Creates an encoded binary tag holder.static <T,EX extends java.lang.Exception>
@NotNull BinaryTagHolderencode(T nbt, @NotNull Codec<? super T,java.lang.String,?,EX> codec)
Encodesnbt
usingcodec
.<T,DX extends java.lang.Exception>
Tget(@NotNull Codec<T,java.lang.String,DX,?> codec)
Gets the held value as a binary tag.static @NotNull BinaryTagHolder
of(@NotNull java.lang.String string)
Deprecated.for removal since 4.10.0, usebinaryTagHolder(String)
instead.@NotNull java.lang.String
string()
Gets the raw string value.
-
-
-
Method Detail
-
encode
@NotNull static <T,EX extends java.lang.Exception> @NotNull BinaryTagHolder encode(@NotNull T nbt, @NotNull @NotNull Codec<? super T,java.lang.String,?,EX> codec) throws EX extends java.lang.Exception
Encodesnbt
usingcodec
.- Type Parameters:
T
- the binary tag typeEX
- encode exception type- Parameters:
nbt
- the binary tagcodec
- the codec- Returns:
- the encoded binary tag holder
- Throws:
EX
- if an error occurred while encoding the binary tagEX extends java.lang.Exception
- Since:
- 4.0.0
-
binaryTagHolder
@NotNull static @NotNull BinaryTagHolder binaryTagHolder(@NotNull @NotNull java.lang.String string)
Creates an encoded binary tag holder.- Parameters:
string
- the encoded binary tag value- Returns:
- the encoded binary tag
- Since:
- 4.10.0
-
of
@Deprecated @ScheduledForRemoval(inVersion="5.0.0") @NotNull static @NotNull BinaryTagHolder of(@NotNull @NotNull java.lang.String string)
Deprecated.for removal since 4.10.0, usebinaryTagHolder(String)
instead.Creates an encoded binary tag holder.- Parameters:
string
- the encoded binary tag value- Returns:
- the encoded binary tag
- Since:
- 4.0.0
-
string
@NotNull @NotNull java.lang.String string()
Gets the raw string value.- Returns:
- the raw string value
- Since:
- 4.0.0
-
get
@NotNull <T,DX extends java.lang.Exception> T get(@NotNull @NotNull Codec<T,java.lang.String,DX,?> codec) throws DX extends java.lang.Exception
Gets the held value as a binary tag.- Type Parameters:
T
- the binary tag typeDX
- decode thrown exception type- Parameters:
codec
- the codec- Returns:
- the binary tag
- Throws:
DX
- if an error occurred while retrieving the binary tagDX extends java.lang.Exception
- Since:
- 4.0.0
-
-