3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-12-28 09:00:09 +01:00

Fix accidental casting

Might have forgotten to actually commit this, whoopsie
Dieser Commit ist enthalten in:
KennyTV 2020-06-28 20:44:45 +02:00
Ursprung ed0db721dd
Commit 26b90b6d71
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 6BE3B555EBC5982B

Datei anzeigen

@ -35,14 +35,13 @@ public class ChatRewriter {
String action = hoverEvent.getAsJsonPrimitive("action").getAsString(); String action = hoverEvent.getAsJsonPrimitive("action").getAsString();
if (!action.equals("show_item")) return; if (!action.equals("show_item")) return;
JsonElement value = hoverEvent.getAsJsonObject("value"); JsonElement value = hoverEvent.get("value");
if (value == null) return; if (value == null) return;
String text = findItemNBT(value); String text = findItemNBT(value);
System.out.println(text); if (text == null) return;
try { try {
CompoundTag tag = BinaryTagIO.readString(text); CompoundTag tag = BinaryTagIO.readString(text);
System.out.println(tag);
CompoundTag itemTag = tag.get("tag"); CompoundTag itemTag = tag.get("tag");
ShortTag damageTag = tag.get("Damage"); ShortTag damageTag = tag.get("Damage");
@ -67,8 +66,6 @@ public class ChatRewriter {
String serializedNBT = BinaryTagIO.writeString(tag); String serializedNBT = BinaryTagIO.writeString(tag);
object.addProperty("text", serializedNBT); object.addProperty("text", serializedNBT);
hoverEvent.add("value", array); hoverEvent.add("value", array);
System.out.println(serializedNBT);
} catch (IOException e) { } catch (IOException e) {
Via.getPlatform().getLogger().warning("Invalid NBT in show_item:"); Via.getPlatform().getLogger().warning("Invalid NBT in show_item:");
e.printStackTrace(); e.printStackTrace();