diff --git a/build.gradle.kts b/build.gradle.kts index 54b5f736..079ca492 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -22,6 +22,7 @@ dependencies { implementation(project(path = ":eco-core:core-plugin", configuration = "shadow")) implementation(project(":eco-core:core-proxy")) implementation(project(":eco-core:core-backend")) + implementation(project(":eco-core:core-backend-modern")) implementation(project(path = ":eco-core:core-nms:v1_17_R1", configuration = "reobf")) implementation(project(path = ":eco-core:core-nms:v1_18_R1", configuration = "reobf")) implementation(project(path = ":eco-core:core-nms:v1_18_R2", configuration = "reobf")) diff --git a/eco-core/core-backend-modern/build.gradle.kts b/eco-core/core-backend-modern/build.gradle.kts new file mode 100644 index 00000000..8d6db439 --- /dev/null +++ b/eco-core/core-backend-modern/build.gradle.kts @@ -0,0 +1,19 @@ +group = "com.willfp" +version = rootProject.version + +dependencies { + compileOnly(project(":eco-core:core-backend")) + compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT") +} + +tasks { + compileJava { + options.release = 21 + } + + compileKotlin { + kotlinOptions { + jvmTarget = "21" + } + } +} diff --git a/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/ModernEntityArgParsersImpl.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/ModernEntityArgParsersImpl.kt new file mode 100644 index 00000000..afd6409a --- /dev/null +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/ModernEntityArgParsersImpl.kt @@ -0,0 +1,13 @@ +package com.willfp.eco.internal.compat.modern.entities + +import com.willfp.eco.core.entities.Entities +import com.willfp.eco.internal.compat.modern.entities.parsers.EntityArgParserJumpStrength +import com.willfp.eco.internal.compat.modern.entities.parsers.EntityArgParserScale +import com.willfp.eco.internal.entities.ModernEntityArgParsers + +class ModernEntityArgParsersImpl: ModernEntityArgParsers { + override fun registerAll() { + Entities.registerArgParser(EntityArgParserScale) + Entities.registerArgParser(EntityArgParserJumpStrength) + } +} diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserJumpStrength.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/parsers/EntityArgParserJumpStrength.kt similarity index 95% rename from eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserJumpStrength.kt rename to eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/parsers/EntityArgParserJumpStrength.kt index 515a8773..954cc1b4 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserJumpStrength.kt +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/parsers/EntityArgParserJumpStrength.kt @@ -1,4 +1,4 @@ -package com.willfp.eco.internal.entities +package com.willfp.eco.internal.compat.modern.entities.parsers import com.willfp.eco.core.entities.args.EntityArgParseResult import com.willfp.eco.core.entities.args.EntityArgParser @@ -40,4 +40,4 @@ object EntityArgParserJumpStrength : EntityArgParser { } ) } -} \ No newline at end of file +} diff --git a/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/parsers/EntityArgParserScale.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/parsers/EntityArgParserScale.kt new file mode 100644 index 00000000..95d24a14 --- /dev/null +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/entities/parsers/EntityArgParserScale.kt @@ -0,0 +1,45 @@ +package com.willfp.eco.internal.compat.modern.entities.parsers + +import com.willfp.eco.core.entities.args.EntityArgParseResult +import com.willfp.eco.core.entities.args.EntityArgParser +import org.bukkit.attribute.Attribute +import org.bukkit.entity.LivingEntity +import org.bukkit.entity.Phantom +import org.bukkit.entity.Slime + +object EntityArgParserScale : EntityArgParser { + override fun parseArguments(args: Array): EntityArgParseResult? { + var attributeValue: Double? = null + + for (arg in args) { + val argSplit = arg.split(":") + if (!argSplit[0].equals("scale", ignoreCase = true)) { + continue + } + if (argSplit.size < 2) { + continue + } + attributeValue = argSplit[1].toDoubleOrNull() + } + + attributeValue ?: return null + + return EntityArgParseResult( + { + if (it !is LivingEntity) { + return@EntityArgParseResult false + } + + val inst = it.getAttribute(Attribute.GENERIC_SCALE) ?: return@EntityArgParseResult false + inst.value >= attributeValue + }, + { + if (it !is LivingEntity) { + return@EntityArgParseResult + } + + it.getAttribute(Attribute.GENERIC_SCALE)?.baseValue = attributeValue + } + ) + } +} diff --git a/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/ModernItemArgParsersImpl.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/ModernItemArgParsersImpl.kt new file mode 100644 index 00000000..2d4dd062 --- /dev/null +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/ModernItemArgParsersImpl.kt @@ -0,0 +1,21 @@ +package com.willfp.eco.internal.compat.modern.items + +import com.willfp.eco.core.items.Items +import com.willfp.eco.internal.compat.modern.items.parsers.ArgParserFireResistant +import com.willfp.eco.internal.compat.modern.items.parsers.ArgParserGlint +import com.willfp.eco.internal.compat.modern.items.parsers.ArgParserItemName +import com.willfp.eco.internal.compat.modern.items.parsers.ArgParserMaxDamage +import com.willfp.eco.internal.compat.modern.items.parsers.ArgParserMaxStackSize +import com.willfp.eco.internal.compat.modern.items.parsers.ArgParserTrim +import com.willfp.eco.internal.items.ModernItemArgParsers + +class ModernItemArgParsersImpl : ModernItemArgParsers { + override fun registerAll() { + Items.registerArgParser(ArgParserTrim) + Items.registerArgParser(ArgParserFireResistant) + Items.registerArgParser(ArgParserGlint) + Items.registerArgParser(ArgParserItemName) + Items.registerArgParser(ArgParserMaxDamage) + Items.registerArgParser(ArgParserMaxStackSize) + } +} diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserFireResistant.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserFireResistant.kt similarity index 85% rename from eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserFireResistant.kt rename to eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserFireResistant.kt index 9a2c2b57..08b6dffa 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserFireResistant.kt +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserFireResistant.kt @@ -1,4 +1,4 @@ -package com.willfp.eco.internal.items.modern +package com.willfp.eco.internal.compat.modern.items.parsers import com.willfp.eco.internal.items.templates.FlagArgParser import org.bukkit.inventory.meta.ItemMeta diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserGlint.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserGlint.kt similarity index 85% rename from eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserGlint.kt rename to eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserGlint.kt index 4efe6d99..eb8a50aa 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserGlint.kt +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserGlint.kt @@ -1,4 +1,4 @@ -package com.willfp.eco.internal.items.modern +package com.willfp.eco.internal.compat.modern.items.parsers import com.willfp.eco.internal.items.templates.FlagArgParser import org.bukkit.inventory.meta.ItemMeta diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserItemName.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserItemName.kt similarity index 92% rename from eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserItemName.kt rename to eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserItemName.kt index d390455c..fac84ea5 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserItemName.kt +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserItemName.kt @@ -1,4 +1,4 @@ -package com.willfp.eco.internal.items.modern +package com.willfp.eco.internal.compat.modern.items.parsers import com.willfp.eco.internal.items.templates.ValueArgParser import com.willfp.eco.util.StringUtils diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserMaxDamage.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserMaxDamage.kt similarity index 75% rename from eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserMaxDamage.kt rename to eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserMaxDamage.kt index d815e19e..373488f7 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserMaxDamage.kt +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserMaxDamage.kt @@ -1,12 +1,8 @@ -package com.willfp.eco.internal.items.modern +package com.willfp.eco.internal.compat.modern.items.parsers import com.willfp.eco.internal.items.templates.ValueArgParser -import com.willfp.eco.util.StringUtils -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.minimessage.MiniMessage import org.bukkit.inventory.meta.Damageable import org.bukkit.inventory.meta.ItemMeta -import org.checkerframework.checker.units.qual.m object ArgParserMaxDamage : ValueArgParser("max_damage") { override fun parse(arg: String): Int? { diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserMaxStackSize.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserMaxStackSize.kt similarity index 65% rename from eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserMaxStackSize.kt rename to eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserMaxStackSize.kt index 4c9af0f7..2482aa04 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserMaxStackSize.kt +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserMaxStackSize.kt @@ -1,12 +1,7 @@ -package com.willfp.eco.internal.items.modern +package com.willfp.eco.internal.compat.modern.items.parsers import com.willfp.eco.internal.items.templates.ValueArgParser -import com.willfp.eco.util.StringUtils -import net.kyori.adventure.text.Component -import net.kyori.adventure.text.minimessage.MiniMessage -import org.bukkit.inventory.meta.Damageable import org.bukkit.inventory.meta.ItemMeta -import org.checkerframework.checker.units.qual.m object ArgParserMaxStackSize : ValueArgParser("max_stack_size") { override fun parse(arg: String): Int? { diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserTrim.kt b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserTrim.kt similarity index 97% rename from eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserTrim.kt rename to eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserTrim.kt index 8c7122e7..0ce973be 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/modern/ArgParserTrim.kt +++ b/eco-core/core-backend-modern/src/main/kotlin/com/willfp/eco/internal/compat/modern/items/parsers/ArgParserTrim.kt @@ -1,4 +1,4 @@ -package com.willfp.eco.internal.items.modern +package com.willfp.eco.internal.compat.modern.items.parsers import com.willfp.eco.core.items.args.LookupArgParser import org.bukkit.NamespacedKey diff --git a/eco-core/core-backend/build.gradle.kts b/eco-core/core-backend/build.gradle.kts index 59a77f67..94614290 100644 --- a/eco-core/core-backend/build.gradle.kts +++ b/eco-core/core-backend/build.gradle.kts @@ -6,7 +6,7 @@ dependencies { implementation("org.reflections:reflections:0.9.12") implementation("org.objenesis:objenesis:3.2") - compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT") + compileOnly("io.papermc.paper:paper-api:1.20.2-R0.1-SNAPSHOT") compileOnly("me.clip:placeholderapi:2.11.4") compileOnly("net.kyori:adventure-text-minimessage:4.10.0") compileOnly("net.kyori:adventure-platform-bukkit:4.1.0") @@ -16,12 +16,12 @@ dependencies { tasks { compileJava { - options.release = 21 + options.release = 17 } compileKotlin { kotlinOptions { - jvmTarget = "21" + jvmTarget = "17" } } } diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/compat/ModernCompatibility.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/compat/ModernCompatibility.kt new file mode 100644 index 00000000..321fd85c --- /dev/null +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/compat/ModernCompatibility.kt @@ -0,0 +1,68 @@ +package com.willfp.eco.internal.compat + +import com.willfp.eco.core.Prerequisite +import com.willfp.eco.core.proxy.exceptions.ProxyError + +private const val BASE_PACKAGE = "com.willfp.eco.internal.compat.modern" +private val isModern = Prerequisite.HAS_PAPER.isMet && Prerequisite.HAS_1_21.isMet + +internal annotation class ModernCompatibilityProxy( + val location: String +) + +private val cache = mutableMapOf, Any>() + +object ModernCompatibilityScope { + inline fun loadProxy(): T { + return loadCompatibilityProxy(T::class.java) + } + + inline fun useProxy(block: T.() -> Any?) { + val proxy = loadProxy() + + with(proxy) { + block() + } + } +} + +fun ifModern(block: ModernCompatibilityScope.() -> R) { + if (!isModern) { + return + } + + block(ModernCompatibilityScope) +} + +fun loadCompatibilityProxy(clazz: Class): T { + @Suppress("UNCHECKED_CAST") + return cache.getOrPut(clazz) { + loadProxyUncached(clazz) + } as T +} + +private fun loadProxyUncached(clazz: Class<*>): Any { + val proxy = clazz.getAnnotation(ModernCompatibilityProxy::class.java) + val location = proxy?.location ?: throw IllegalArgumentException("Class ${clazz.name} is not a proxy") + val className = "$BASE_PACKAGE.$location" + + try { + val found = Class.forName(className) + + val constructor = found.getConstructor() + val instance = constructor.newInstance() + + if (!clazz.isInstance(instance)) { + throw ProxyError( + "Modern compatibility proxy class $className does not implement ${clazz.name}", + ClassCastException() + ) + } + + return instance + } catch (e: ClassNotFoundException) { + throw ProxyError("Could not find modern compatibility proxy class $className", e) + } catch (e: NoSuchMethodException) { + throw ProxyError("Could not find no-args constructor for modern compatibility proxy class $className", e) + } +} diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserFlySpeed.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserFlySpeed.kt index 1cdc5f75..ed647284 100644 --- a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserFlySpeed.kt +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/EntityArgParserFlySpeed.kt @@ -40,4 +40,4 @@ object EntityArgParserFlySpeed : EntityArgParser { } ) } -} \ No newline at end of file +} diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/ModernEntityArgParsers.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/ModernEntityArgParsers.kt new file mode 100644 index 00000000..27a77942 --- /dev/null +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/entities/ModernEntityArgParsers.kt @@ -0,0 +1,8 @@ +package com.willfp.eco.internal.entities + +import com.willfp.eco.internal.compat.ModernCompatibilityProxy + +@ModernCompatibilityProxy("entities.ModernEntityArgParsersImpl") +interface ModernEntityArgParsers { + fun registerAll() +} diff --git a/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ModernItemArgParsers.kt b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ModernItemArgParsers.kt new file mode 100644 index 00000000..1431f47f --- /dev/null +++ b/eco-core/core-backend/src/main/kotlin/com/willfp/eco/internal/items/ModernItemArgParsers.kt @@ -0,0 +1,8 @@ +package com.willfp.eco.internal.items + +import com.willfp.eco.internal.compat.ModernCompatibilityProxy + +@ModernCompatibilityProxy("items.ModernItemArgParsersImpl") +interface ModernItemArgParsers { + fun registerAll() +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt index 137ed711..ca8ce9f8 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/eco/internal/spigot/EcoSpigotPlugin.kt @@ -20,16 +20,38 @@ import com.willfp.eco.core.items.Items import com.willfp.eco.core.packet.PacketListener import com.willfp.eco.core.particle.Particles import com.willfp.eco.core.price.Prices +import com.willfp.eco.internal.compat.ifModern import com.willfp.eco.internal.data.MavenVersionToStringAdapter import com.willfp.eco.internal.data.VersionToStringAdapter -import com.willfp.eco.internal.entities.* -import com.willfp.eco.internal.items.* -import com.willfp.eco.internal.items.modern.ArgParserFireResistant -import com.willfp.eco.internal.items.modern.ArgParserGlint -import com.willfp.eco.internal.items.modern.ArgParserItemName -import com.willfp.eco.internal.items.modern.ArgParserMaxDamage -import com.willfp.eco.internal.items.modern.ArgParserMaxStackSize -import com.willfp.eco.internal.items.modern.ArgParserTrim +import com.willfp.eco.internal.entities.EntityArgParserAdult +import com.willfp.eco.internal.entities.EntityArgParserAttackDamage +import com.willfp.eco.internal.entities.EntityArgParserAttackSpeed +import com.willfp.eco.internal.entities.EntityArgParserBaby +import com.willfp.eco.internal.entities.EntityArgParserCharged +import com.willfp.eco.internal.entities.EntityArgParserEquipment +import com.willfp.eco.internal.entities.EntityArgParserExplosionRadius +import com.willfp.eco.internal.entities.EntityArgParserFlySpeed +import com.willfp.eco.internal.entities.EntityArgParserFollowRange +import com.willfp.eco.internal.entities.EntityArgParserHealth +import com.willfp.eco.internal.entities.EntityArgParserKnockback +import com.willfp.eco.internal.entities.EntityArgParserKnockbackResistance +import com.willfp.eco.internal.entities.EntityArgParserName +import com.willfp.eco.internal.entities.EntityArgParserNoAI +import com.willfp.eco.internal.entities.EntityArgParserSilent +import com.willfp.eco.internal.entities.EntityArgParserSize +import com.willfp.eco.internal.entities.EntityArgParserSpawnReinforcements +import com.willfp.eco.internal.entities.EntityArgParserSpeed +import com.willfp.eco.internal.entities.ModernEntityArgParsers +import com.willfp.eco.internal.items.ArgParserColor +import com.willfp.eco.internal.items.ArgParserCustomModelData +import com.willfp.eco.internal.items.ArgParserEnchantment +import com.willfp.eco.internal.items.ArgParserEntity +import com.willfp.eco.internal.items.ArgParserFlag +import com.willfp.eco.internal.items.ArgParserHead +import com.willfp.eco.internal.items.ArgParserName +import com.willfp.eco.internal.items.ArgParserTexture +import com.willfp.eco.internal.items.ArgParserUnbreakable +import com.willfp.eco.internal.items.ModernItemArgParsers import com.willfp.eco.internal.lookup.SegmentParserGroup import com.willfp.eco.internal.lookup.SegmentParserUseIfPresent import com.willfp.eco.internal.particle.ParticleFactoryRGB @@ -43,16 +65,50 @@ import com.willfp.eco.internal.spigot.data.PlayerBlockListener import com.willfp.eco.internal.spigot.data.ProfileHandler import com.willfp.eco.internal.spigot.data.storage.ProfileSaver import com.willfp.eco.internal.spigot.drops.CollatedRunnable -import com.willfp.eco.internal.spigot.eventlisteners.* +import com.willfp.eco.internal.spigot.eventlisteners.EntityDeathByEntityListeners +import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListenersPaper +import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListenersSpigot +import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersPaper +import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersSpigot import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorChangeEventListeners import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorListener import com.willfp.eco.internal.spigot.gui.GUIListener import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationCMI import com.willfp.eco.internal.spigot.integrations.afk.AFKIntegrationEssentials -import com.willfp.eco.internal.spigot.integrations.anticheat.* -import com.willfp.eco.internal.spigot.integrations.antigrief.* +import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatAAC +import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatAlice +import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatMatrix +import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatNCP +import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatSpartan +import com.willfp.eco.internal.spigot.integrations.anticheat.AnticheatVulcan +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefBentoBox +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCombatLogXV10 +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCombatLogXV11 +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefCrashClaim +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefDeluxeCombat +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefFabledSkyBlock +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefFactionsUUID +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefGriefPrevention +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefHuskClaims +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefHuskTowns +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefIridiumSkyblock +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefKingdoms +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefLands +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefPvPManager +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefRPGHorses +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefSuperiorSkyblock2 +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefTowny +import com.willfp.eco.internal.spigot.integrations.antigrief.AntigriefWorldGuard import com.willfp.eco.internal.spigot.integrations.customentities.CustomEntitiesMythicMobs -import com.willfp.eco.internal.spigot.integrations.customitems.* +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsCustomCrafting +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsDenizen +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsExecutableItems +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsHeadDatabase +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsItemBridge +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsItemsAdder +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsMythicMobs +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsOraxen +import com.willfp.eco.internal.spigot.integrations.customitems.CustomItemsScyther import com.willfp.eco.internal.spigot.integrations.customrecipes.CustomRecipeCustomCrafting import com.willfp.eco.internal.spigot.integrations.economy.EconomyVault import com.willfp.eco.internal.spigot.integrations.entitylookup.EntityLookupModelEngine @@ -104,13 +160,10 @@ abstract class EcoSpigotPlugin : EcoPlugin() { Items.registerArgParser(ArgParserHead) Items.registerArgParser(ArgParserEntity) - if (Prerequisite.HAS_PAPER.isMet && Prerequisite.HAS_1_21.isMet) { - Items.registerArgParser(ArgParserTrim) - Items.registerArgParser(ArgParserFireResistant) - Items.registerArgParser(ArgParserGlint) - Items.registerArgParser(ArgParserItemName) - Items.registerArgParser(ArgParserMaxDamage) - Items.registerArgParser(ArgParserMaxStackSize) + ifModern { + useProxy { + registerAll() + } } Entities.registerArgParser(EntityArgParserName) @@ -120,7 +173,6 @@ abstract class EcoSpigotPlugin : EcoPlugin() { Entities.registerArgParser(EntityArgParserFlySpeed) Entities.registerArgParser(EntityArgParserFollowRange) Entities.registerArgParser(EntityArgParserHealth) - Entities.registerArgParser(EntityArgParserJumpStrength) Entities.registerArgParser(EntityArgParserKnockback) Entities.registerArgParser(EntityArgParserKnockbackResistance) Entities.registerArgParser(EntityArgParserSize) @@ -133,6 +185,12 @@ abstract class EcoSpigotPlugin : EcoPlugin() { Entities.registerArgParser(EntityArgParserSilent) Entities.registerArgParser(EntityArgParserEquipment) + ifModern { + useProxy { + registerAll() + } + } + Prices.registerPriceFactory(PriceFactoryEconomy) Prices.registerPriceFactory(PriceFactoryXPLevels) Prices.registerPriceFactory(PriceFactoryXP) diff --git a/settings.gradle.kts b/settings.gradle.kts index 75ed5fea..48786c73 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -29,4 +29,5 @@ include(":eco-core:core-nms:v1_20_R3") include(":eco-core:core-nms:v1_21") include(":eco-core:core-proxy") include(":eco-core:core-plugin") -include(":eco-core:core-backend") \ No newline at end of file +include(":eco-core:core-backend") +include(":eco-core:core-backend-modern") \ No newline at end of file