mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-30 08:06:01 +00:00
More armor trim fixes (#108)
This commit is contained in:
parent
f9f5f1b345
commit
d749843f1e
@ -5,15 +5,25 @@ 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
|
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
|
index c92981aedebe934cefa1c96a0328fb91fe17acbc..2eb3705e1efdd62fa176bf4a1ec126181d083505 100644
|
||||||
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
||||||
+++ b/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 {
|
@@ -68,10 +68,15 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta {
|
||||||
TrimMaterial trimMaterial = Registry.TRIM_MATERIAL.get(NamespacedKey.fromString(trimCompound.getString(TRIM_MATERIAL.NBT)));
|
CompoundTag trimCompound = tag.getCompound(TRIM.NBT);
|
||||||
TrimPattern trimPattern = Registry.TRIM_PATTERN.get(NamespacedKey.fromString(trimCompound.getString(TRIM_PATTERN.NBT)));
|
|
||||||
|
if (trimCompound.contains(TRIM_MATERIAL.NBT, net.minecraft.nbt.Tag.TAG_STRING) && trimCompound.contains(TRIM_PATTERN.NBT, net.minecraft.nbt.Tag.TAG_STRING)) { // Paper - for now, ignore inline definitions of trim material & pattern
|
||||||
|
- 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)));
|
||||||
|
+ // Scissors start
|
||||||
|
+ NamespacedKey trimMaterialKey = NamespacedKey.fromString(trimCompound.getString(TRIM_MATERIAL.NBT));
|
||||||
|
+ NamespacedKey trimPatternKey = NamespacedKey.fromString(trimCompound.getString(TRIM_PATTERN.NBT));
|
||||||
|
|
||||||
- this.trim = new ArmorTrim(trimMaterial, trimPattern);
|
- this.trim = new ArmorTrim(trimMaterial, trimPattern);
|
||||||
+ if (trimMaterial != null && trimPattern != null) this.trim = new ArmorTrim(trimMaterial, trimPattern); // Scissors
|
+ TrimMaterial trimMaterial = trimMaterialKey != null ? Registry.TRIM_MATERIAL.get(trimMaterialKey) : null;
|
||||||
|
+ TrimPattern trimPattern = trimPatternKey != null ? Registry.TRIM_PATTERN.get(trimPatternKey) : null;
|
||||||
|
+
|
||||||
|
+ if (trimMaterial != null && trimPattern != null) this.trim = new ArmorTrim(trimMaterial, trimPattern);
|
||||||
|
+ // Scissors end
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user