Merge pull request #76 from IntellectualSites/new-vector-system2

Revert "Make end tag singleton"
This commit is contained in:
Josh Knight 2019-03-25 06:09:13 -04:00 committed by GitHub
commit 4c3b09895d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 661 additions and 670 deletions

View File

@ -440,7 +440,7 @@ public final class Spigot_v1_13_R2 extends CachedBukkitAdapter implements Bukkit
} else if (foreign instanceof NBTTagString) {
return new StringTag(foreign.asString()); // data
} else if (foreign instanceof NBTTagEnd) {
return EndTag.INSTANCE;
return new EndTag();
} else {
throw new IllegalArgumentException("Don't know how to make native " + foreign.getClass().getCanonicalName());
}

View File

@ -174,7 +174,7 @@ public class FaweCache {
if (clazz.getName().startsWith("com.intellectualcrafters.jnbt")) {
try {
if (clazz.getName().equals("com.intellectualcrafters.jnbt.EndTag")) {
return EndTag.INSTANCE;
return new EndTag();
}
Field field = clazz.getDeclaredField("value");
field.setAccessible(true);

View File

@ -9,24 +9,18 @@ import java.io.DataInput;
import java.io.DataInputStream;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.function.BiConsumer;
import java.util.function.Function;
public class NBTStreamer {
private final NBTInputStream is;
private final Map<String, BiConsumer> readers;
private final HashMap<String, BiConsumer> readers;
public NBTStreamer(NBTInputStream stream) {
this.is = stream;
readers = new HashMap<>();
}
public NBTStreamer(NBTInputStream stream, Map<String, BiConsumer> readers) {
this.is = stream;
this.readers = readers;
}
/**
* Reads the entire stream and runs the applicable readers
*

View File

@ -23,9 +23,6 @@ package com.sk89q.jnbt;
* The {@code TAG_End} tag.
*/
public final class EndTag extends Tag {
public static final EndTag INSTANCE = new EndTag();
private EndTag() {}
@Override
public Object getValue() {

View File

@ -532,7 +532,7 @@ public final class NBTInputStream implements Closeable {
throw new IOException(
"TAG_End found without a TAG_Compound/TAG_List tag preceding it.");
} else {
return EndTag.INSTANCE;
return new EndTag();
}
case NBTConstants.TYPE_BYTE:
return new ByteTag(is.readByte());

View File

@ -217,7 +217,7 @@ final class NBTConverter {
}
public static EndTag fromNative(NBTTagEnd other) {
return EndTag.INSTANCE;
return new EndTag();
}
public static LongTag fromNative(NBTTagLong other) {