Skip to content

Commit 29c5532

Browse files
committed
Update ItemData.java
1 parent 6a9d099 commit 29c5532

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

src/main/java/ch/njol/skript/aliases/ItemData.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import ch.njol.yggdrasil.YggdrasilSerializable.YggdrasilExtendedSerializable;
1212
import org.bukkit.Bukkit;
1313
import org.bukkit.Material;
14-
import org.bukkit.NamespacedKey;
1514
import org.bukkit.block.Block;
1615
import org.bukkit.block.BlockState;
1716
import 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

Comments
 (0)