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

CraftMetaItem: Cannot deserialize BlockStateTag

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • This server is running CraftBukkit version dev-Spigot-a0f3d48-dc45a67 (MC: 1.20.2) (Implementing API version 1.20.2-R0.1-SNAPSHOT)
    • Yes

      Error during deserialization of items with block state data:

      Serialized item:

      item:
        ==: org.bukkit.inventory.ItemStack
        v: 3578
        type: BEE_NEST
        meta:
          ==: ItemMeta
          meta-type: TILE_ENTITY
          BlockStateTag: |-
          {
            honey_level: "5"
          }
          internal: H4sIAAAAAAAA/+NiYOBi4HPKyU/Ods0rySypDElM52RgcUpNLWaAAACK5YvWIgAAAA==
          blockMaterial: BEE_NEST
      

      Error during deserialization:

      Caused by: org.bukkit.configuration.InvalidConfigurationException: Could not call method 'public static org.bukkit.inventory.meta.ItemMeta org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.deserialize(java.util.Map) throws java.lang.Throwable' of class org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta for deserialization
              ... 34 more
      Caused by: java.lang.IllegalArgumentException: BlockStateTag({
          honey_level: 5
      }) is not a valid interface java.util.Map
              at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.getObject(CraftMetaItem.java:233) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:dev-Spigot-a0f3d48-dc45a67]
              at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem.<init>(CraftMetaItem.java:488) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:dev-Spigot-a0f3d48-dc45a67]
              at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaBlockState.<init>(CraftMetaBlockState.java:164) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:dev-Spigot-a0f3d48-dc45a67]
              at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:?]
              at jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[?:?]
              at jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:?]
              at java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[?:?]
              at java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[?:?]
              at org.bukkit.craftbukkit.v1_20_R2.inventory.CraftMetaItem$SerializableMeta.deserialize(CraftMetaItem.java:197) ~[spigot-1.20.2-R0.1-SNAPSHOT.jar:dev-Spigot-a0f3d48-dc45a67]
              at jdk.internal.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) ~[?:?]
              at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
              at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
              at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeViaMethod(ConfigurationSerialization.java:85) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.serialization.ConfigurationSerialization.deserialize(ConfigurationSerialization.java:127) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.serialization.ConfigurationSerialization.deserializeObject(ConfigurationSerialization.java:207) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:58) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264) ~[snakeyaml-2.2.jar:?]
              at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247) ~[snakeyaml-2.2.jar:?]
              at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping2ndStep(BaseConstructor.java:576) ~[snakeyaml-2.2.jar:?]
              at org.yaml.snakeyaml.constructor.SafeConstructor.constructMapping2ndStep(SafeConstructor.java:210) ~[snakeyaml-2.2.jar:?]
              at org.yaml.snakeyaml.constructor.BaseConstructor.constructMapping(BaseConstructor.java:552) ~[snakeyaml-2.2.jar:?]
              at org.yaml.snakeyaml.constructor.SafeConstructor$ConstructYamlMap.construct(SafeConstructor.java:597) ~[snakeyaml-2.2.jar:?]
              at org.bukkit.configuration.file.YamlConstructor$ConstructCustomObject.construct(YamlConstructor.java:49) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.yaml.snakeyaml.constructor.BaseConstructor.constructObjectNoCheck(BaseConstructor.java:264) ~[snakeyaml-2.2.jar:?]
              at org.yaml.snakeyaml.constructor.BaseConstructor.constructObject(BaseConstructor.java:247) ~[snakeyaml-2.2.jar:?]
              at org.bukkit.configuration.file.YamlConstructor.construct(YamlConstructor.java:37) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:162) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:160) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:160) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.file.YamlConfiguration.fromNodeTree(YamlConfiguration.java:160) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
              at org.bukkit.configuration.file.YamlConfiguration.loadFromString(YamlConfiguration.java:119) ~[spigot-api-1.20.2-R0.1-SNAPSHOT.jar:?]
      

      I think this issue is related to the recent change of serializing PDC as string rather than Map (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/f0661c3514a7d8e51e2281f045e1c14d0e733230#src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java):
      The CraftNBTTagConfigSerialize was changed to produce a string now. However, this is not only used by the PDC, but also for the `blockData` of items containing block state data (https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java#1238). But the deserialization of the block state data was not adjusted and still tries to load the data as a Map rather than object. https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java#484

            Unassigned Unassigned
            blablubbabc blablubbabc
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: