2022-07-28 03:57:50 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Video <videogamesm12@gmail.com>
|
|
|
|
Date: Wed, 30 Mar 2022 18:20:09 -0600
|
|
|
|
Subject: [PATCH] Prevent attributes with invalid namespaces from being applied
|
|
|
|
to CraftMetaItems
|
|
|
|
|
|
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
2023-12-11 00:23:09 +00:00
|
|
|
index 1b5cb36430ea8cb16491c92184051005453ee297..6292c6726a5ccf420cc81fdfa6b22a6d7a69b2b9 100644
|
2022-07-28 03:57:50 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java
|
2023-12-11 00:23:09 +00:00
|
|
|
@@ -47,6 +47,7 @@ import net.minecraft.nbt.NbtIo;
|
2022-07-28 03:57:50 +00:00
|
|
|
import net.minecraft.nbt.StringTag;
|
|
|
|
import net.minecraft.nbt.Tag;
|
|
|
|
import net.minecraft.network.chat.Component;
|
2023-07-01 20:21:13 +00:00
|
|
|
+import net.minecraft.resources.ResourceLocation; // Scissors
|
2022-07-28 03:57:50 +00:00
|
|
|
import net.minecraft.world.item.BlockItem;
|
2023-06-09 00:58:46 +00:00
|
|
|
import net.minecraft.world.level.block.state.BlockState;
|
2023-06-13 17:45:38 +00:00
|
|
|
import org.apache.commons.lang3.EnumUtils;
|
2023-12-11 00:23:09 +00:00
|
|
|
@@ -488,7 +489,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta {
|
2022-07-28 03:57:50 +00:00
|
|
|
AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier);
|
|
|
|
|
2023-10-29 20:36:20 +00:00
|
|
|
String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(CraftMetaItem.ATTRIBUTES_IDENTIFIER.NBT)); // Paper
|
2022-07-28 03:57:50 +00:00
|
|
|
- if (attributeName == null || attributeName.isEmpty()) {
|
|
|
|
+ if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|