Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-7563

Array UUID format in show_entity hover isn't supported

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version 4005-Spigot-828f059-dd8cca3 (MC: 1.20.4) (Implementing API version 1.20.4-R0.1-SNAPSHOT)
    • Yes

      Minecraft recently added support for representing the UUID in a `show_entity` hover event as an array of integers.

      BungeeCord chat was already updated for this: #3578: bungeecord-chat does not support array format UUIDs · SpigotMC/BungeeCord@b711e40 (github.com)

      But it seems Spigot is still on an outdated version, tested with the following JSON string & code:

      {"text":"test","hoverEvent":{"action":"show_entity","contents":{"type":"minecraft:cow","name":"A cow","id":[410807316,673401202,-1461765392,1569381605]}}}
      Bukkit.dispatchCommand(sender, "tellraw @p " + JSON); // Works fine
      sender.spigot().sendMessage(ComponentSerializer.parse(JSON)); // Errors 

      The tellraw works as expected and shows up in chat, but the ComponentSerializer#parse call throws the following exception:

      java.lang.IllegalStateException: Array must have size 1, but has size 4
              at com.google.gson.JsonArray.getAsSingleElement(JsonArray.java:236) ~[gson-2.10.1.jar:?]
              at com.google.gson.JsonArray.getAsString(JsonArray.java:262) ~[gson-2.10.1.jar:?]
              at net.md_5.bungee.api.chat.hover.content.EntitySerializer.deserialize(EntitySerializer.java:23) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at net.md_5.bungee.api.chat.hover.content.EntitySerializer.deserialize(EntitySerializer.java:13) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1227) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1329) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1300) ~[gson-2.10.1.jar:?]
              at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179) ~[gson-2.10.1.jar:?]
              at net.md_5.bungee.chat.BaseComponentSerializer.deserialize(BaseComponentSerializer.java:102) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:26) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at net.md_5.bungee.chat.TextComponentSerializer.deserialize(TextComponentSerializer.java:13) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1227) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1329) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1300) ~[gson-2.10.1.jar:?]
              at com.google.gson.internal.bind.TreeTypeAdapter$GsonContextImpl.deserialize(TreeTypeAdapter.java:179) ~[gson-2.10.1.jar:?]
              at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:107) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at net.md_5.bungee.chat.ComponentSerializer.deserialize(ComponentSerializer.java:27) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at com.google.gson.internal.bind.TreeTypeAdapter.read(TreeTypeAdapter.java:76) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1227) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1329) ~[gson-2.10.1.jar:?]
              at com.google.gson.Gson.fromJson(Gson.java:1271) ~[gson-2.10.1.jar:?]
              at net.md_5.bungee.chat.ComponentSerializer.parse(ComponentSerializer.java:57) ~[bungeecord-chat-1.20-R0.1.jar:?]
              at aya.test.spigottestplugin.SpigotTestPlugin.onCommand(SpigotTestPlugin.java:27) ~[?:?]
              at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[spigot-api-1.20.4-R0.1-SNAPSHOT.jar:?]
              ... 29 more

       

            md_5 md_5
            Aya Tal K
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: