1111import ch .njol .yggdrasil .YggdrasilSerializable .YggdrasilExtendedSerializable ;
1212import org .bukkit .Bukkit ;
1313import org .bukkit .Material ;
14- import org .bukkit .NamespacedKey ;
1514import org .bukkit .block .Block ;
1615import org .bukkit .block .BlockState ;
1716import org .bukkit .block .data .BlockData ;
@@ -565,7 +564,7 @@ public boolean matchPlain(ItemData other) {
565564 @ Override
566565 public Fields serialize () throws NotSerializableException {
567566 Fields fields = new Fields (this ); // ItemStack is transient, will be ignored
568- fields .putObject ("key" , type .getKey ());
567+ fields .putObject ("key" , type .getKey (). toString () );
569568 fields .putObject ("meta" , stack != null ? stack .getItemMeta () : null );
570569 return fields ;
571570 }
@@ -575,10 +574,10 @@ public Fields serialize() throws NotSerializableException {
575574 @ Override
576575 public void deserialize (Fields fields ) throws StreamCorruptedException , NotSerializableException {
577576 if (fields .hasField ("key" )) {
578- NamespacedKey key = fields .getAndRemoveObject ("key" , NamespacedKey .class );
577+ String key = fields .getAndRemoveObject ("key" , String .class );
579578 if (key == null )
580579 throw new StreamCorruptedException ("Material key is null" );
581- this .type = Material .matchMaterial (key . toString () );
580+ this .type = Material .matchMaterial (key );
582581 } else {
583582 // attempt back compat deserialization, though using ordinals is not reliable
584583 this .type = materials [fields .getAndRemovePrimitive ("id" , int .class )];
0 commit comments