diff --git a/build.gradle.kts b/build.gradle.kts index 5490542..7550af3 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -2,7 +2,7 @@ plugins { java `maven-publish` id("com.github.johnrengelman.shadow") version "8.1.1" apply false - id("io.papermc.paperweight.patcher") version "1.5.8" + id("io.papermc.paperweight.patcher") version "1.5.9" } val paperMavenPublicUrl = "https://repo.papermc.io/repository/maven-public/" diff --git a/gradle.properties b/gradle.properties index 5b57fc4..9014e9e 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,7 +2,7 @@ group=me.totalfreedom.scissors version=1.20.2-R0.1-SNAPSHOT mcVersion=1.20.2 -paperRef=c1ac98328c3b4dc2834497aae70020af7b3c7d04 +paperRef=1865625d958b94d82e0bd601d6d860318980c4c4 org.gradle.caching=true org.gradle.parallel=true diff --git a/patches/server/0003-ResourceLocation-validation.patch b/patches/server/0003-ResourceLocation-validation.patch index 3e1f1a6..bc946a2 100644 --- a/patches/server/0003-ResourceLocation-validation.patch +++ b/patches/server/0003-ResourceLocation-validation.patch @@ -123,18 +123,18 @@ index 081691f9710ff1115e4308f79ed49fbc38941193..c29dfd15e147d5c4d9c9584ff7803c2a this.lootTableSeed = nbt.getLong("LootTableSeed"); return false; // Paper - always load the items, table may still remain diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -index 5b9ccbd767630abfee648a4653f33d8ac625bd0c..05830258ba0f7d19b1d86c0d8c85df8ffc94dfce 100644 +index f6942cb3ef1f9ef03708d4bc932ea9aeb1c13894..8b32864bafb3c1948993688be8f639dd6492057e 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java @@ -34,8 +34,14 @@ public abstract class CraftLootable return null; } -- ResourceLocation key = getSnapshot().lootTable; +- ResourceLocation key = this.getSnapshot().lootTable; - return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key)); + // Scissors start - Return a null loot table if the specified loot table is not valid + try { -+ ResourceLocation key = getSnapshot().lootTable; ++ ResourceLocation key = this.getSnapshot().lootTable; + return Bukkit.getLootTable(CraftNamespacedKey.fromMinecraft(key)); + } catch (Exception ex) { + return null; @@ -144,7 +144,7 @@ index 5b9ccbd767630abfee648a4653f33d8ac625bd0c..05830258ba0f7d19b1d86c0d8c85df8f @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java -index 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf11cf046fb 100644 +index 313ee5c8737b2e57f9b5db6512c1871766b2ccd4..aa7fa17b9fb8519d8b57e27a5b422249b9b875d8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java @@ -33,8 +33,14 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo @@ -165,7 +165,7 @@ index 0dd0ce9a9b3253e87eda12354249ec2fd2a33cf2..b6920f9432ca1736afbe775186fbbcf1 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index 153e4c88c168097eb4a78650e7c9c120bec202a3..4d6af55197bb6933daac50fc638f9c23fe652f39 100644 +index b4e45d8e9851552f30c9c29d3d9671e1e9094c38..4e8e1a6b718d9ec8720efb648ab023e9e39f67e3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java @@ -80,8 +80,14 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { diff --git a/patches/server/0015-Add-Scissors-configuration-file-command.patch b/patches/server/0015-Add-Scissors-configuration-file-command.patch index f2a7c3d..b7996de 100644 --- a/patches/server/0015-Add-Scissors-configuration-file-command.patch +++ b/patches/server/0015-Add-Scissors-configuration-file-command.patch @@ -426,7 +426,7 @@ index ec268189b19b6fa5c4521f96ce211a531db35ec5..343cb72710ef100cf7e4de1e081cfdc2 if (optionset.has("initSettings")) { // CraftBukkit diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java -index dbccbcb9b44e4efacdf53c2d161115cc20b36cff..c3eb9eef724fa04ede965c5875b948c829fafb5d 100644 +index 2b5d82fbf4e7ec32d0c53dd3e8207b1dba708bbd..84102c09874e6fc070050fb8b89b99fb28578af0 100644 --- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java @@ -222,6 +222,16 @@ public class DedicatedServer extends MinecraftServer implements ServerInterface @@ -447,13 +447,13 @@ index dbccbcb9b44e4efacdf53c2d161115cc20b36cff..c3eb9eef724fa04ede965c5875b948c8 this.setFlightAllowed(dedicatedserverproperties.allowFlight); this.setMotd(dedicatedserverproperties.motd); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f7c3b65e0d6c76189aea00232b33722c4363d7dd..8b872a406752a72d49ff029e2586d4ac17d7be1f 100644 +index 2c3dbeb929c9ec110aee390299f13006f0a4ec66..3708b9c68300694a377001fa17b87d6cf5c59779 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1038,6 +1038,7 @@ public final class CraftServer implements Server { } - org.spigotmc.SpigotConfig.init((File) console.options.valueOf("spigot-settings")); // Spigot + org.spigotmc.SpigotConfig.init((File) this.console.options.valueOf("spigot-settings")); // Spigot + me.totalfreedom.scissors.ScissorsConfig.init(((File) console.options.valueOf("scissors-settings"))); // Scissors this.console.paperConfigurations.reloadConfigs(this.console); for (ServerLevel world : this.console.getAllLevels()) { @@ -466,7 +466,7 @@ index f7c3b65e0d6c76189aea00232b33722c4363d7dd..8b872a406752a72d49ff029e2586d4ac this.overrideAllCommandBlockCommands = this.commandsConfiguration.getStringList("command-block-overrides").contains("*"); this.ignoreVanillaPermissions = this.commandsConfiguration.getBoolean("ignore-vanilla-permissions"); -@@ -2914,6 +2916,14 @@ public final class CraftServer implements Server { +@@ -2915,6 +2917,14 @@ public final class CraftServer implements Server { return CraftServer.this.console.paperConfigurations.createLegacyObject(CraftServer.this.console); } @@ -482,7 +482,7 @@ index f7c3b65e0d6c76189aea00232b33722c4363d7dd..8b872a406752a72d49ff029e2586d4ac public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/Main.java b/src/main/java/org/bukkit/craftbukkit/Main.java -index ebec18e919885f9220693a8a419d239e8cddd567..544698c044d9eef57abccfbd41cbfdd6873e4f55 100644 +index 9838e5cb3da6b668653378cb2f5f620de1c2aaba..0ca722589a7e6fe83174c0c3e6aa31b841232efe 100644 --- a/src/main/java/org/bukkit/craftbukkit/Main.java +++ b/src/main/java/org/bukkit/craftbukkit/Main.java @@ -180,6 +180,20 @@ public class Main { diff --git a/patches/server/0016-Prevent-attributes-with-invalid-namespaces-from-bein.patch b/patches/server/0016-Prevent-attributes-with-invalid-namespaces-from-bein.patch index 5cf9b5b..ffa7156 100644 --- a/patches/server/0016-Prevent-attributes-with-invalid-namespaces-from-bein.patch +++ b/patches/server/0016-Prevent-attributes-with-invalid-namespaces-from-bein.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Prevent attributes with invalid namespaces from being applied diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 5bd581c1a82236359c810037333590d0d9741587..35d640654ec483b98eeddb4887107a07f93f57aa 100644 +index ed6e5060901c348c4f56a573c23e2000d8f2fb72..5cdf1e6fcdc9e2bd821f40ec9bf95cf03f03179a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -46,6 +46,7 @@ import net.minecraft.nbt.NbtIo; @@ -20,7 +20,7 @@ index 5bd581c1a82236359c810037333590d0d9741587..35d640654ec483b98eeddb4887107a07 @@ -487,7 +488,7 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { AttributeModifier attribMod = CraftAttributeInstance.convert(nmsModifier); - String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(ATTRIBUTES_IDENTIFIER.NBT)); // Paper + String attributeName = CraftAttributeMap.convertIfNeeded(entry.getString(CraftMetaItem.ATTRIBUTES_IDENTIFIER.NBT)); // Paper - if (attributeName == null || attributeName.isEmpty()) { + if (attributeName == null || attributeName.isEmpty() || attributeName.length() > 256 || !ResourceLocation.isValidResourceLocation(attributeName)) { // Scissors continue;