From d4a6bf105b92eb51cd48b5187639eca780404dda Mon Sep 17 00:00:00 2001 From: Exanthiax <107284021+Exanthiax@users.noreply.github.com> Date: Wed, 24 Jul 2024 01:55:20 +0100 Subject: [PATCH 1/8] Update ParticleFactoryRGB.kt --- .../com/willfp/eco/internal/particle/ParticleFactoryRGB.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/particle/ParticleFactoryRGB.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/particle/ParticleFactoryRGB.kt index 3fd65d6d..e9d68fbf 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/particle/ParticleFactoryRGB.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/particle/ParticleFactoryRGB.kt @@ -12,7 +12,7 @@ object ParticleFactoryRGB : ParticleFactory { if (Prerequisite.HAS_1_20_5.isMet) { Particle.valueOf("DUST") } else { - Particle.valueOf("REDSTONE_DUST") + Particle.valueOf("REDSTONE") } }.getOrNull() From 06fdb259256d75bdddeba56db6c1b60e4e8ac8c2 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 21 Aug 2024 18:08:39 +0100 Subject: [PATCH 2/8] Patch for ArgParserEnchantment --- .../eco/internal/items/ArgParserEnchantment.kt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEnchantment.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEnchantment.kt index 750c6ebf..043a8f32 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEnchantment.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ArgParserEnchantment.kt @@ -14,12 +14,16 @@ object ArgParserEnchantment : LookupArgParser { val enchants = mutableMapOf() for (arg in args) { - val argSplit = arg.split(":") + try { + val argSplit = arg.split(":") - val enchant = Enchantment.getByKey(NamespacedKey.minecraft(argSplit[0].lowercase())) ?: continue - val level = argSplit.getOrNull(1)?.toIntOrNull() ?: enchant.maxLevel + val enchant = Enchantment.getByKey(NamespacedKey.minecraft(argSplit[0].lowercase())) ?: continue + val level = argSplit.getOrNull(1)?.toIntOrNull() ?: enchant.maxLevel - enchants[enchant] = level + enchants[enchant] = level + } catch (e: IllegalArgumentException) { + continue + } } if (enchants.isEmpty()) { From 6c91b4e41f896958b69a48ec96b7017529ec2f1c Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 21 Aug 2024 18:08:50 +0100 Subject: [PATCH 3/8] Updated to 6.73.5 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index a885a79a..1361917c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 6.73.4 +version = 6.73.5 kotlin.incremental.useClasspathSnapshot=false \ No newline at end of file From f01691663a10e51ad246a77f34d6de025c371ee6 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Wed, 21 Aug 2024 18:22:02 +0100 Subject: [PATCH 4/8] Fixed ProtocolLib --- build.gradle.kts | 2 +- eco-core/core-plugin/build.gradle.kts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 3cfaf032..1e0b2db7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -63,7 +63,7 @@ allprojects { maven("https://repo.extendedclip.com/content/repositories/placeholderapi/") // ProtocolLib - //maven("https://repo.dmulloy2.net/nexus/repository/public/") + maven("https://repo.dmulloy2.net/nexus/repository/public/") // WorldGuard maven("https://maven.enginehub.org/repo/") diff --git a/eco-core/core-plugin/build.gradle.kts b/eco-core/core-plugin/build.gradle.kts index 7b17443a..124a4864 100644 --- a/eco-core/core-plugin/build.gradle.kts +++ b/eco-core/core-plugin/build.gradle.kts @@ -29,7 +29,7 @@ dependencies { compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT") // Plugin dependencies - compileOnly("com.comphenix.protocol:ProtocolLib:5.0.0-SNAPSHOT") + compileOnly("com.comphenix.protocol:ProtocolLib:5.1.0") compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.7-SNAPSHOT") compileOnly("com.github.TechFortress:GriefPrevention:16.17.1") compileOnly("com.github.TownyAdvanced:Towny:0.99.5.21") { From 9cb596e7464f275652703a69b95f5e71a7b09a63 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 23 Aug 2024 15:18:21 +0100 Subject: [PATCH 5/8] Fixed FastItemStack#getEnchants(true) giving incorrect results when the enchantment component was removed from an item --- .../internal/spigot/proxy/common/modern/NewEcoFastItemStack.kt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eco-core/core-nms/modern/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/modern/NewEcoFastItemStack.kt b/eco-core/core-nms/modern/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/modern/NewEcoFastItemStack.kt index a5a6fe8a..8cc652b6 100644 --- a/eco-core/core-nms/modern/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/modern/NewEcoFastItemStack.kt +++ b/eco-core/core-nms/modern/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/modern/NewEcoFastItemStack.kt @@ -25,6 +25,7 @@ import net.minecraft.util.Unit import net.minecraft.world.item.component.CustomData import net.minecraft.world.item.component.CustomModelData import net.minecraft.world.item.component.ItemLore +import net.minecraft.world.item.enchantment.ItemEnchantments import org.bukkit.Bukkit import org.bukkit.craftbukkit.CraftRegistry import org.bukkit.craftbukkit.CraftServer @@ -53,7 +54,7 @@ class NewEcoFastItemStack( private val pdc = (handle.get(DataComponents.CUSTOM_DATA)?.copyTag() ?: CompoundTag()).makePdc() override fun getEnchants(checkStored: Boolean): Map { - val enchantments = handle.get(DataComponents.ENCHANTMENTS) ?: return emptyMap() + val enchantments = handle.get(DataComponents.ENCHANTMENTS) ?: ItemEnchantments.EMPTY val map = mutableMapOf() From 2ed1f2bb2fa040eb99f0659cb79d14abafb6f21e Mon Sep 17 00:00:00 2001 From: Auxilor Date: Fri, 23 Aug 2024 15:18:30 +0100 Subject: [PATCH 6/8] Updated to 6.73.6 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 1361917c..51df8954 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 6.73.5 +version = 6.73.6 kotlin.incremental.useClasspathSnapshot=false \ No newline at end of file From afcbcfa527c21ef15203cd99526d49dd2f402c61 Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 24 Aug 2024 14:01:02 +0100 Subject: [PATCH 7/8] Fixed PacketAutoRecipe --- .../proxy/common/packet/display/PacketAutoRecipe.kt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/eco-core/core-nms/common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/packet/display/PacketAutoRecipe.kt b/eco-core/core-nms/common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/packet/display/PacketAutoRecipe.kt index bd8e3354..32870af7 100644 --- a/eco-core/core-nms/common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/packet/display/PacketAutoRecipe.kt +++ b/eco-core/core-nms/common/src/main/kotlin/com/willfp/eco/internal/spigot/proxy/common/packet/display/PacketAutoRecipe.kt @@ -3,12 +3,19 @@ package com.willfp.eco.internal.spigot.proxy.common.packet.display import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.packet.PacketEvent import com.willfp.eco.core.packet.PacketListener +import com.willfp.eco.internal.spigot.proxy.common.toResourceLocation +import com.willfp.eco.util.namespacedKeyOf import net.minecraft.network.protocol.game.ClientboundPlaceGhostRecipePacket import net.minecraft.resources.ResourceLocation class PacketAutoRecipe( private val plugin: EcoPlugin ) : PacketListener { + private val fKey = ClientboundPlaceGhostRecipePacket::class.java + .declaredFields + .first { it.type == ResourceLocation::class.java } + .apply { isAccessible = true } + override fun onSend(event: PacketEvent) { val packet = event.packet.handle as? ClientboundPlaceGhostRecipePacket ?: return @@ -24,9 +31,7 @@ class PacketAutoRecipe( return } - val fKey = packet.javaClass.getDeclaredField("b") - fKey.isAccessible = true val key = fKey[packet] as ResourceLocation - fKey[packet] = ResourceLocation(key.namespace, key.path + "_displayed") + fKey[packet] = namespacedKeyOf(key.namespace, key.path + "_displayed").toResourceLocation() } } From 93bcf6ce4465a96448368e821cb430e9968e0f3e Mon Sep 17 00:00:00 2001 From: Auxilor Date: Sat, 24 Aug 2024 14:01:12 +0100 Subject: [PATCH 8/8] Updated to 6.73.7 --- gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradle.properties b/gradle.properties index 51df8954..9152c89d 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ -version = 6.73.6 +version = 6.73.7 kotlin.incremental.useClasspathSnapshot=false \ No newline at end of file