13
0
geforkt von Mirrors/Paper

Fix NPE for color-related metas

Fixes #10789
Dieser Commit ist enthalten in:
Jake Potrebic 2024-05-25 19:55:51 -07:00
Ursprung f0bd0cca8f
Commit 41bee55b53
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 27CC63F7CBC866C7

Datei anzeigen

@ -516,7 +516,7 @@ index f8c02fe01fd95aa5de8523c9ad452d91f5d3c16f..4447c754458e9fdead003b4044bf2bee
if (this.items == null) {
this.items = new ArrayList<>();
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaColorableArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaColorableArmor.java
index 2c9ca54267579a210d4ea192517fc0fbce8e467a..3109df67e42838f3e69681326efb1caf237548a5 100644
index 2c9ca54267579a210d4ea192517fc0fbce8e467a..20fdd48779237d1d91d5a8f2325cd9dc824e08b5 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaColorableArmor.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaColorableArmor.java
@@ -22,16 +22,30 @@ public class CraftMetaColorableArmor extends CraftMetaArmor implements Colorable
@ -586,6 +586,15 @@ index 2c9ca54267579a210d4ea192517fc0fbce8e467a..3109df67e42838f3e69681326efb1caf
}
@Override
@@ -97,7 +115,7 @@ public class CraftMetaColorableArmor extends CraftMetaArmor implements Colorable
if (meta instanceof CraftMetaColorableArmor) {
CraftMetaColorableArmor that = (CraftMetaColorableArmor) meta;
- return this.color.equals(that.color);
+ return this.hasColor() ? that.hasColor() && this.color.equals(that.color) : !that.hasColor(); // Paper - allow null
}
return true;
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java
index bbca26f5debb263b04516e68f6e49f68a38fa5b1..aacc4d010f4dfa4d9d11332b802205a6f35b6de3 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaCompass.java
@ -1093,7 +1102,7 @@ index 12a193db7475870e5107c86c7611bb4b92feacb8..c235b80b94fdb6c77766016114713cd5
return (result != null) ? result : Optional.empty();
}
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java
index 157a7b7351f48e68d2923c72ed3bbe3dcae21383..051e3c4e5020fdf1392f888bfb4a633db69e5c5f 100644
index 157a7b7351f48e68d2923c72ed3bbe3dcae21383..ce8cd736ababe3e6153efe27f943c027fb920fb2 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaLeatherArmor.java
@@ -28,16 +28,30 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta {
@ -1163,6 +1172,15 @@ index 157a7b7351f48e68d2923c72ed3bbe3dcae21383..051e3c4e5020fdf1392f888bfb4a633d
}
@Override
@@ -101,7 +119,7 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta {
if (meta instanceof CraftMetaLeatherArmor) {
CraftMetaLeatherArmor that = (CraftMetaLeatherArmor) meta;
- return this.color.equals(that.color);
+ return this.hasColor() ? that.hasColor() && this.color.equals(that.color) : !that.hasColor(); // Paper - allow null
}
return true;
}
@@ -121,14 +139,16 @@ class CraftMetaLeatherArmor extends CraftMetaItem implements LeatherArmorMeta {
return original != hash ? CraftMetaLeatherArmor.class.hashCode() ^ hash : hash;
}