|
40 | 40 | import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; |
41 | 41 | import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; |
42 | 42 | import org.cloudburstmc.nbt.NbtMap; |
43 | | -import org.cloudburstmc.nbt.NbtType; |
44 | 43 | import org.cloudburstmc.protocol.bedrock.packet.TextPacket; |
45 | 44 | import org.geysermc.geyser.GeyserImpl; |
46 | 45 | import org.geysermc.geyser.session.GeyserSession; |
47 | | -import org.geysermc.geyser.text.*; |
| 46 | +import org.geysermc.geyser.text.ChatColor; |
| 47 | +import org.geysermc.geyser.text.ChatDecoration; |
| 48 | +import org.geysermc.geyser.text.DummyLegacyHoverEventSerializer; |
| 49 | +import org.geysermc.geyser.text.GeyserLocale; |
| 50 | +import org.geysermc.geyser.text.GsonComponentSerializerWrapper; |
| 51 | +import org.geysermc.geyser.text.MinecraftTranslationRegistry; |
48 | 52 | import org.geysermc.mcprotocollib.protocol.data.DefaultComponentSerializer; |
49 | 53 | import org.geysermc.mcprotocollib.protocol.data.game.Holder; |
50 | 54 | import org.geysermc.mcprotocollib.protocol.data.game.chat.ChatType; |
51 | 55 | import org.geysermc.mcprotocollib.protocol.data.game.chat.ChatTypeDecoration; |
52 | 56 | import org.geysermc.mcprotocollib.protocol.data.game.scoreboard.TeamColor; |
53 | 57 |
|
54 | | -import java.util.*; |
| 58 | +import java.util.ArrayList; |
| 59 | +import java.util.EnumMap; |
| 60 | +import java.util.List; |
| 61 | +import java.util.Map; |
55 | 62 |
|
56 | 63 | public class MessageTranslator { |
57 | 64 | // These are used for handling the translations of the messages |
@@ -434,7 +441,7 @@ public static String normalizeSpace(String string) { |
434 | 441 | * Deserialize an NbtMap with a description text component (usually provided from a registry) into a Bedrock-formatted string. |
435 | 442 | */ |
436 | 443 | public static String deserializeDescription(GeyserSession session, NbtMap tag) { |
437 | | - NbtMap description = tag.getCompound("description"); |
| 444 | + Object description = tag.get("description"); |
438 | 445 | Component parsed = componentFromNbtTag(description); |
439 | 446 | return convertMessage(session, parsed); |
440 | 447 | } |
@@ -482,7 +489,8 @@ private static Component componentFromNbtTag(Object nbtTag, Style style) { |
482 | 489 | } |
483 | 490 | } |
484 | 491 |
|
485 | | - throw new IllegalArgumentException("Expected tag to be a literal string, a list of components, or a component object with a text/translate key"); |
| 492 | + GeyserImpl.getInstance().getLogger().error("Expected tag to be a literal string, a list of components, or a component object with a text/translate key: " + nbtTag); |
| 493 | + return Component.empty(); |
486 | 494 | } |
487 | 495 |
|
488 | 496 | private static List<Component> componentsFromNbtList(List<?> list, Style style) { |
|
0 commit comments