Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using WrapperPlayServerSystemChatMessage kicks players when the message contains translation key #1107

Open
Kaeios opened this issue Jan 6, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@Kaeios
Copy link

Kaeios commented Jan 6, 2025

Describe the bug

if(event.packetType == PacketType.Play.Server.SYSTEM_CHAT_MESSAGE)
        packet = WrapperPlayServerSystemChatMessage(event)

This line of code kick the player receiving the packet when the message received contains a translation key, there is also an error thrown in the Bungeecord console

io.netty.handler.codec.DecoderException: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Not a JSON Object: "minecraft:gold_ingot"
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:98)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:103)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:346)
    at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:318)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:444)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:412)
    at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1407)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:440)
    at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:420)
    at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:918)
    at io.netty.channel.epoll.AbstractEpollStreamChannel$EpollStreamUnsafe.epollInReady(AbstractEpollStreamChannel.java:799)
    at io.netty.channel.epoll.EpollEventLoop.processReady(EpollEventLoop.java:501)
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:399)
    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:994)
    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
    at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: com.google.gson.JsonSyntaxException: java.lang.IllegalStateException: Not a JSON Object: "minecraft:gold_ingot"
    at com.google.gson.Gson.fromJson(Gson.java:1238)
    at com.google.gson.Gson.fromJson(Gson.java:1329)
    at com.google.gson.Gson.fromJson(Gson.java:1300)
    at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179)
    at net.md_5.bungee.chat.BaseComponentSerializer.deserialize(BaseComponentSerializer.java:77)
    at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:26)
    at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:13)
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1329)
    at com.google.gson.Gson.fromJson(Gson.java:1300)
    at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179)
    at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:229)
    at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:31)
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1329)
    at com.google.gson.Gson.fromJson(Gson.java:1300)
    at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179)
    at net.md_5.bungee.chat.BaseComponentSerializer.deserialize(BaseComponentSerializer.java:93)
    at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:26)
    at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:13)
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1329)
    at com.google.gson.Gson.fromJson(Gson.java:1300)
    at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179)
    at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:229)
    at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:31)
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.read(TypeAdapterRuntimeTypeWrapper.java:40)
    at com.google.gson.internal.bind.ArrayTypeAdapter.read(ArrayTypeAdapter.java:72)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1329)
    at com.google.gson.Gson.fromJson(Gson.java:1300)
    at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179)
    at net.md_5.bungee.chat.BaseComponentSerializer.deserialize(BaseComponentSerializer.java:93)
    at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:26)
    at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:13)
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1329)
    at com.google.gson.Gson.fromJson(Gson.java:1300)
    at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179)
    at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:229)
    at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:31)
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    at com.google.gson.Gson.fromJson(Gson.java:1329)
    at com.google.gson.Gson.fromJson(Gson.java:1271)
    at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:121)
    at net.md_5.bungee.protocol.DefinedPacket.readBaseComponent(DefinedPacket.java:113)
    at net.md_5.bungee.protocol.packet.SystemChat.read(SystemChat.java:27)
    at net.md_5.bungee.protocol.DefinedPacket.read(DefinedPacket.java:524)
    at net.md_5.bungee.protocol.MinecraftDecoder.decode(MinecraftDecoder.java:42)
    at net.md_5.bungee.protocol.MinecraftDecoder.decode(MinecraftDecoder.java:11)
    at io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
    ... 22 more
Caused by: java.lang.IllegalStateException: Not a JSON Object: "minecraft:gold_ingot"
    at com.google.gson.JsonElement.getAsJsonObject(JsonElement.java:101)
    at net.md_5.bungee.api.chat.hover.content.ItemSerializer.deserialize(ItemSerializer.java:20)
    at net.md_5.bungee.api.chat.hover.content.ItemSerializer.deserialize(ItemSerializer.java:14)
    at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76)
    at com.google.gson.Gson.fromJson(Gson.java:1227)
    ... 80 more

Software brand
Paper-459 (MC: 1.20.4)

Plugins
image

How To Reproduce
Steps to reproduce the behavior:
Example:

  1. Upload a plugin using the code provided in the issue
  2. Join with the 1.20.4 vanilla minecraft client.
  3. Send a message using translation key for an item /tellraw @a [{"translate":"item.minecraft.gold_ingot"}]
  4. You got kicked and if using bungee, an error is thrown is the bungee console.

Expected behavior
The error shouldn't happen.

@Kaeios Kaeios added the bug Something isn't working label Jan 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant