Mirror von
https://github.com/ViaVersion/ViaBackwards.git
synchronisiert 2025-01-12 07:56:15 +01:00
Print bad component on deserialization fail
Dieser Commit ist enthalten in:
Ursprung
5f59a57a78
Commit
51d07c1c50
@ -17,6 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.chat;
|
package com.viaversion.viabackwards.protocol.protocol1_15_2to1_16.chat;
|
||||||
|
|
||||||
|
import com.viaversion.viabackwards.ViaBackwards;
|
||||||
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
import com.viaversion.viabackwards.api.BackwardsProtocol;
|
||||||
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
import com.viaversion.viabackwards.api.rewriters.TranslatableRewriter;
|
||||||
import com.viaversion.viaversion.libs.gson.JsonElement;
|
import com.viaversion.viaversion.libs.gson.JsonElement;
|
||||||
@ -72,12 +73,17 @@ public class TranslatableRewriter1_16 extends TranslatableRewriter {
|
|||||||
// show_text as chat component
|
// show_text as chat component
|
||||||
// show_entity and show_item serialized as nbt
|
// show_entity and show_item serialized as nbt
|
||||||
// Let adventure handle all of that
|
// Let adventure handle all of that
|
||||||
Component component = ChatRewriter.HOVER_GSON_SERIALIZER.deserializeFromTree(object);
|
try {
|
||||||
JsonObject processedHoverEvent = ((JsonObject) ChatRewriter.HOVER_GSON_SERIALIZER.serializeToTree(component)).getAsJsonObject("hoverEvent");
|
Component component = ChatRewriter.HOVER_GSON_SERIALIZER.deserializeFromTree(object);
|
||||||
|
JsonObject processedHoverEvent = ((JsonObject) ChatRewriter.HOVER_GSON_SERIALIZER.serializeToTree(component)).getAsJsonObject("hoverEvent");
|
||||||
|
|
||||||
// Remove new format
|
// Remove new format
|
||||||
processedHoverEvent.remove("contents");
|
processedHoverEvent.remove("contents");
|
||||||
object.add("hoverEvent", processedHoverEvent);
|
object.add("hoverEvent", processedHoverEvent);
|
||||||
|
} catch (Exception e) {
|
||||||
|
ViaBackwards.getPlatform().getLogger().severe("Error converting hover event component: " + object);
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
x
In neuem Issue referenzieren
Einen Benutzer sperren