Skip to content

Commit 3ba6ab2

Browse files
authored
Merge pull request #1192 from GliczDev/tagstringio-tostring-tag
Add TagStringIO#asString for any tag
2 parents 6f63939 + f98a776 commit 3ba6ab2

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

nbt/src/main/java/net/kyori/adventure/nbt/TagStringIO.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,18 @@ public CompoundBinaryTag asCompound(final String input) throws IOException {
101101
* @since 4.0.0
102102
*/
103103
public String asString(final CompoundBinaryTag input) throws IOException {
104+
return this.asString((BinaryTag) input);
105+
}
106+
107+
/**
108+
* Get a string representation of the provided tag.
109+
*
110+
* @param input tag to serialize
111+
* @return serialized form
112+
* @throws IOException if any errors occur writing to string
113+
* @since 4.20.0
114+
*/
115+
public String asString(final BinaryTag input) throws IOException {
104116
final StringBuilder sb = new StringBuilder();
105117
try (final TagStringWriter emit = new TagStringWriter(sb, this.indent)) {
106118
emit.legacy(this.emitLegacy);

0 commit comments

Comments
 (0)