mirror of
https://github.com/AtlasMediaGroup/Scissors.git
synced 2024-11-17 10:56:10 +00:00
2109ba025d
* Remove patch that is now in Paper * Redirect Paper's safe component method to ours
30 lines
2.0 KiB
Diff
30 lines
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Luna <lunahatesgogle@gmail.com>
|
|
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..2eb3705e1efdd62fa176bf4a1ec126181d083505 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmor.java
|
|
@@ -68,10 +68,15 @@ public class CraftMetaArmor extends CraftMetaItem implements ArmorMeta {
|
|
CompoundTag trimCompound = tag.getCompound(TRIM.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);
|
|
+ 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
|
|
}
|
|
}
|
|
}
|