From e7512f7b6d0ae129d1c1f35cc50919912fb18aed Mon Sep 17 00:00:00 2001 From: Luna <90072930+LunaWasFlaggedAgain@users.noreply.github.com> Date: Mon, 12 Jun 2023 18:28:48 -0300 Subject: [PATCH] Fix invalid armor trim exploit (#98) --- .../0051-Fix-invalid-armor-trim-exploit.patch | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 patches/server/0051-Fix-invalid-armor-trim-exploit.patch diff --git a/patches/server/0051-Fix-invalid-armor-trim-exploit.patch b/patches/server/0051-Fix-invalid-armor-trim-exploit.patch new file mode 100644 index 0000000..55358a2 --- /dev/null +++ b/patches/server/0051-Fix-invalid-armor-trim-exploit.patch @@ -0,0 +1,19 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Luna +Date: Mon, 12 Jun 2023 17:32:04 -0300 +Subject: [PATCH] Fix invalid armor trim exploit + + +diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java +index c92981aedebe934cefa1c96a0328fb91fe17acbc..a1e1a94f0eb46b7eb3fe19e416e21e29b33f3e9f 100644 +--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java ++++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java +@@ -71,7 +71,7 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta { + TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(TRIM_MATERIAL.NBT))); + TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(TRIM_PATTERN.NBT))); + +- this.trim = new ArmorTrim(trimMaterial, trimPattern); ++ if (trimMaterial != null && trimPattern != null) this.trim = new ArmorTrim(trimMaterial, trimPattern); // Scissors + } + } + }