diff --git a/eco-core/core-nms/build.gradle b/eco-core/core-nms/build.gradle new file mode 100644 index 00000000..e65ada98 --- /dev/null +++ b/eco-core/core-nms/build.gradle @@ -0,0 +1,9 @@ +group 'com.willfp' +version rootProject.version + +subprojects { + dependencies { + compileOnly project(':eco-core:core-proxy') + compileOnly project(':eco-core:core-plugin') + } +} diff --git a/eco-core/core-nms/v1_17_R1/build.gradle b/eco-core/core-nms/v1_17_R1/build.gradle new file mode 100644 index 00000000..e732641e --- /dev/null +++ b/eco-core/core-nms/v1_17_R1/build.gradle @@ -0,0 +1,6 @@ +group 'com.willfp' +version rootProject.version + +dependencies { + compileOnly 'org.spigotmc:spigot:1.17-R0.1-SNAPSHOT' +} \ No newline at end of file diff --git a/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantment.kt b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantment.kt new file mode 100644 index 00000000..2fc2480e --- /dev/null +++ b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantment.kt @@ -0,0 +1,27 @@ +package com.willfp.ecoenchants.proxy.v1_17_R1 + +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import net.minecraft.world.item.enchantment.Enchantment +import org.bukkit.NamespacedKey +import org.bukkit.craftbukkit.v1_17_R1.enchantments.CraftEnchantment + +class EcoCraftEnchantment( + target: Enchantment, + private val _maxLevel: Int, + private val conflicts: Collection +) : CraftEnchantment(target) { + override fun getMaxLevel(): Int = _maxLevel + + override fun conflictsWith(other: org.bukkit.enchantments.Enchantment): Boolean { + if (other is EcoEnchant) { + return other.conflictsWith(this) + } + + return conflicts.contains(other.key) + } + + fun register() { + EcoEnchants.register(this) + } +} diff --git a/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantmentManager.kt b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantmentManager.kt new file mode 100644 index 00000000..d6c7d46f --- /dev/null +++ b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/EcoCraftEnchantmentManager.kt @@ -0,0 +1,20 @@ +package com.willfp.ecoenchants.proxy.v1_17_R1 + +import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment + +class EcoCraftEnchantmentManager : EcoCraftEnchantmentManagerProxy { + override fun registerNewCraftEnchantment( + enchantment: Enchantment, + maxLevel: Int, + conflicts: Collection + ) { + for (enchant in net.minecraft.core.IRegistry.X) { + val key = org.bukkit.craftbukkit.v1_17_R1.util.CraftNamespacedKey.fromMinecraft( + net.minecraft.core.IRegistry.X.getKey(enchant) + ) + EcoCraftEnchantment(enchant, maxLevel, conflicts).register() + } + } +} diff --git a/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/OpenInventory.kt b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/OpenInventory.kt new file mode 100644 index 00000000..135abe1d --- /dev/null +++ b/eco-core/core-nms/v1_17_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_17_R1/OpenInventory.kt @@ -0,0 +1,11 @@ +package com.willfp.ecoenchants.proxy.v1_17_R1 + +import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy +import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer +import org.bukkit.entity.Player + +class OpenInventory : OpenInventoryProxy { + override fun getOpenInventory(player: Player): Any { + return (player as CraftPlayer).handle.bV + } +} diff --git a/eco-core/core-nms/v1_18_R1/build.gradle b/eco-core/core-nms/v1_18_R1/build.gradle new file mode 100644 index 00000000..2aa928f6 --- /dev/null +++ b/eco-core/core-nms/v1_18_R1/build.gradle @@ -0,0 +1,6 @@ +group 'com.willfp' +version rootProject.version + +dependencies { + compileOnly 'org.spigotmc:spigot:1.18-R0.1-SNAPSHOT' +} \ No newline at end of file diff --git a/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantment.kt b/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantment.kt new file mode 100644 index 00000000..78858b88 --- /dev/null +++ b/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantment.kt @@ -0,0 +1,27 @@ +package com.willfp.ecoenchants.proxy.v1_18_R1 + +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import net.minecraft.world.item.enchantment.Enchantment +import org.bukkit.NamespacedKey +import org.bukkit.craftbukkit.v1_18_R1.enchantments.CraftEnchantment + +class EcoCraftEnchantment( + target: Enchantment, + private val _maxLevel: Int, + private val conflicts: Collection +) : CraftEnchantment(target) { + override fun getMaxLevel(): Int = _maxLevel + + override fun conflictsWith(other: org.bukkit.enchantments.Enchantment): Boolean { + if (other is EcoEnchant) { + return other.conflictsWith(this) + } + + return conflicts.contains(other.key) + } + + fun register() { + EcoEnchants.register(this) + } +} diff --git a/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantmentManager.kt b/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantmentManager.kt new file mode 100644 index 00000000..959386be --- /dev/null +++ b/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/EcoCraftEnchantmentManager.kt @@ -0,0 +1,20 @@ +package com.willfp.ecoenchants.proxy.v1_18_R1 + +import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment + +class EcoCraftEnchantmentManager : EcoCraftEnchantmentManagerProxy { + override fun registerNewCraftEnchantment( + enchantment: Enchantment, + maxLevel: Int, + conflicts: Collection + ) { + for (enchant in net.minecraft.core.IRegistry.Y) { + val key = org.bukkit.craftbukkit.v1_18_R1.util.CraftNamespacedKey.fromMinecraft( + net.minecraft.core.IRegistry.Y.b(enchant) + ) + EcoCraftEnchantment(enchant, maxLevel, conflicts).register() + } + } +} diff --git a/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/OpenInventory.kt b/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/OpenInventory.kt new file mode 100644 index 00000000..567a5a98 --- /dev/null +++ b/eco-core/core-nms/v1_18_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R1/OpenInventory.kt @@ -0,0 +1,11 @@ +package com.willfp.ecoenchants.proxy.v1_18_R1 + +import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy +import org.bukkit.craftbukkit.v1_18_R1.entity.CraftPlayer +import org.bukkit.entity.Player + +class OpenInventory : OpenInventoryProxy { + override fun getOpenInventory(player: Player): Any { + return (player as CraftPlayer).handle.bW + } +} diff --git a/eco-core/core-nms/v1_18_R2/build.gradle b/eco-core/core-nms/v1_18_R2/build.gradle new file mode 100644 index 00000000..fb2d9471 --- /dev/null +++ b/eco-core/core-nms/v1_18_R2/build.gradle @@ -0,0 +1,6 @@ +group 'com.willfp' +version rootProject.version + +dependencies { + compileOnly 'org.spigotmc:spigot:1.18.2-R0.1-SNAPSHOT' +} \ No newline at end of file diff --git a/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantment.kt b/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantment.kt new file mode 100644 index 00000000..c3bab6b3 --- /dev/null +++ b/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantment.kt @@ -0,0 +1,27 @@ +package com.willfp.ecoenchants.proxy.v1_18_R2 + +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import net.minecraft.world.item.enchantment.Enchantment +import org.bukkit.NamespacedKey +import org.bukkit.craftbukkit.v1_18_R2.enchantments.CraftEnchantment + +class EcoCraftEnchantment( + target: Enchantment, + private val _maxLevel: Int, + private val conflicts: Collection +) : CraftEnchantment(target) { + override fun getMaxLevel(): Int = _maxLevel + + override fun conflictsWith(other: org.bukkit.enchantments.Enchantment): Boolean { + if (other is EcoEnchant) { + return other.conflictsWith(this) + } + + return conflicts.contains(other.key) + } + + fun register() { + EcoEnchants.register(this) + } +} diff --git a/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantmentManager.kt b/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantmentManager.kt new file mode 100644 index 00000000..d0856bff --- /dev/null +++ b/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/EcoCraftEnchantmentManager.kt @@ -0,0 +1,20 @@ +package com.willfp.ecoenchants.proxy.v1_18_R2 + +import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment + +class EcoCraftEnchantmentManager : EcoCraftEnchantmentManagerProxy { + override fun registerNewCraftEnchantment( + enchantment: Enchantment, + maxLevel: Int, + conflicts: Collection + ) { + for (enchant in net.minecraft.core.IRegistry.V) { + val key = org.bukkit.craftbukkit.v1_18_R2.util.CraftNamespacedKey.fromMinecraft( + net.minecraft.core.IRegistry.V.b(enchant) + ) + EcoCraftEnchantment(enchant, maxLevel, conflicts).register() + } + } +} diff --git a/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/OpenInventory.kt b/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/OpenInventory.kt new file mode 100644 index 00000000..d57578b5 --- /dev/null +++ b/eco-core/core-nms/v1_18_R2/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_18_R2/OpenInventory.kt @@ -0,0 +1,11 @@ +package com.willfp.ecoenchants.proxy.v1_18_R2 + +import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy +import org.bukkit.craftbukkit.v1_18_R2.entity.CraftPlayer +import org.bukkit.entity.Player + +class OpenInventory : OpenInventoryProxy { + override fun getOpenInventory(player: Player): Any { + return (player as CraftPlayer).handle.bV + } +} diff --git a/eco-core/core-nms/v1_19_R1/build.gradle b/eco-core/core-nms/v1_19_R1/build.gradle new file mode 100644 index 00000000..30597aaa --- /dev/null +++ b/eco-core/core-nms/v1_19_R1/build.gradle @@ -0,0 +1,6 @@ +group 'com.willfp' +version rootProject.version + +dependencies { + compileOnly 'org.spigotmc:spigot:1.19.1-R0.1-SNAPSHOT' +} diff --git a/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantment.kt b/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantment.kt new file mode 100644 index 00000000..4325112a --- /dev/null +++ b/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantment.kt @@ -0,0 +1,27 @@ +package com.willfp.ecoenchants.proxy.v1_19_R1 + +import com.willfp.ecoenchants.enchants.EcoEnchant +import com.willfp.ecoenchants.enchants.EcoEnchants +import net.minecraft.world.item.enchantment.Enchantment +import org.bukkit.NamespacedKey +import org.bukkit.craftbukkit.v1_17_R1.enchantments.CraftEnchantment + +class EcoCraftEnchantment( + target: Enchantment, + private val _maxLevel: Int, + private val conflicts: Collection +) : CraftEnchantment(target) { + override fun getMaxLevel(): Int = _maxLevel + + override fun conflictsWith(other: org.bukkit.enchantments.Enchantment): Boolean { + if (other is EcoEnchant) { + return other.conflictsWith(this) + } + + return conflicts.contains(other.key) + } + + fun register() { + EcoEnchants.register(this) + } +} diff --git a/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantmentManager.kt b/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantmentManager.kt new file mode 100644 index 00000000..7a02b055 --- /dev/null +++ b/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/EcoCraftEnchantmentManager.kt @@ -0,0 +1,20 @@ +package com.willfp.ecoenchants.proxy.v1_19_R1 + +import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment + +class EcoCraftEnchantmentManager : EcoCraftEnchantmentManagerProxy { + override fun registerNewCraftEnchantment( + enchantment: Enchantment, + maxLevel: Int, + conflicts: Collection + ) { + for (enchant in net.minecraft.core.IRegistry.W) { + val key = org.bukkit.craftbukkit.v1_19_R1.util.CraftNamespacedKey.fromMinecraft( + net.minecraft.core.IRegistry.W.b(enchant) + ) + EcoCraftEnchantment(enchant, maxLevel, conflicts).register() + } + } +} diff --git a/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/OpenInventory.kt b/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/OpenInventory.kt new file mode 100644 index 00000000..486ebbd4 --- /dev/null +++ b/eco-core/core-nms/v1_19_R1/src/main/kotlin/com/willfp/ecoenchants/proxy/v1_19_R1/OpenInventory.kt @@ -0,0 +1,11 @@ +package com.willfp.ecoenchants.proxy.v1_19_R1 + +import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy +import org.bukkit.craftbukkit.v1_19_R1.entity.CraftPlayer +import org.bukkit.entity.Player + +class OpenInventory : OpenInventoryProxy { + override fun getOpenInventory(player: Player): Any { + return (player as CraftPlayer).handle.bU + } +} diff --git a/eco-core/core-plugin/build.gradle b/eco-core/core-plugin/build.gradle index 01e398b7..a50271d0 100644 --- a/eco-core/core-plugin/build.gradle +++ b/eco-core/core-plugin/build.gradle @@ -3,6 +3,7 @@ version rootProject.version dependencies { compileOnly fileTree(dir: '../../lib', include: ['*.jar']) + compileOnly project(":eco-core:core-proxy") compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT' compileOnly 'net.essentialsx:EssentialsX:2.19.0' } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt index bc031662..9a5066bd 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/EcoEnchantsPlugin.kt @@ -12,6 +12,7 @@ import com.willfp.ecoenchants.config.VanillaEnchantsYml import com.willfp.ecoenchants.display.EnchantDisplay import com.willfp.ecoenchants.enchants.EcoEnchants import com.willfp.ecoenchants.enchants.impl.EnchantmentTelekinesis +import com.willfp.ecoenchants.enchants.registerVanillaEnchants import com.willfp.ecoenchants.integrations.EnchantRegistrations import com.willfp.ecoenchants.integrations.plugins.CMIIntegration import com.willfp.ecoenchants.integrations.plugins.EssentialsIntegration @@ -36,13 +37,13 @@ class EcoEnchantsPlugin : LibReforgePlugin() { override fun handleEnableAdditional() { copyConfigs("enchants") - registerHolderProvider { it.heldEnchantLevels } } override fun handleReloadAdditional() { // Load hardcoded enchantments EnchantmentTelekinesis(this) + registerVanillaEnchants(this) logger.info(EcoEnchants.values().size.toString() + " Enchants Loaded") } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLike.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLike.kt index 782ff3a4..d9479954 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLike.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchantLike.kt @@ -2,6 +2,7 @@ package com.willfp.ecoenchants.enchants import com.github.benmanes.caffeine.cache.Caffeine import com.willfp.ecoenchants.EcoEnchantsPlugin +import com.willfp.ecoenchants.proxy.proxies.EcoCraftEnchantmentManagerProxy import com.willfp.ecoenchants.rarity.EnchantmentRarities import com.willfp.ecoenchants.rarity.EnchantmentRarity import com.willfp.ecoenchants.type.EnchantmentType @@ -67,3 +68,15 @@ class VanillaEcoEnchantLike( return Objects.hash(this.enchant) } } + +fun registerVanillaEnchants(plugin: EcoEnchantsPlugin) { + for (vanilla in plugin.vanillaEnchantsYml.getKeys(false)) { + if (plugin.vanillaEnchantsYml.has("$vanilla.max-level")) { + plugin.getProxy(EcoCraftEnchantmentManagerProxy::class.java).registerNewCraftEnchantment( + Enchantment.getByKey(NamespacedKey.minecraft(vanilla))!!, + plugin.vanillaEnchantsYml.getInt("$vanilla.max-level"), + plugin.vanillaEnchantsYml.getStrings("$vanilla.conflicts").map { NamespacedKey.minecraft(it) } + ) + } + } +} diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt index 1fb04b44..26366747 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/enchants/EcoEnchants.kt @@ -121,18 +121,26 @@ object EcoEnchants { */ @Suppress("UNCHECKED_CAST", "DEPRECATION") internal fun addNewEnchant(enchant: EcoEnchant) { - removeEnchant(enchant) + BY_KEY[enchant.id] = enchant + BY_NAME[ChatColor.stripColor(enchant.displayName)] = enchant + register(enchant) + } + + /** + * Register a new [Enchantment] with the server. + * + * @param enchantment The [Enchantment] to add. + */ + @JvmStatic + fun register(enchantment: Enchantment) { Enchantment::class.java.getDeclaredField("acceptingNew") .apply { isAccessible = true set(null, true) } - BY_KEY[enchant.id] = enchant - BY_NAME[ChatColor.stripColor(enchant.displayName)] = enchant - - Enchantment.registerEnchantment(enchant) + Enchantment.registerEnchantment(enchantment) EnchantRegistrations.registerEnchantments() } } diff --git a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt index 898c32b9..0c5e81a9 100644 --- a/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt +++ b/eco-core/core-plugin/src/main/kotlin/com/willfp/ecoenchants/mechanics/AnvilSupport.kt @@ -4,6 +4,7 @@ import com.willfp.eco.core.EcoPlugin import com.willfp.eco.core.fast.fast import com.willfp.eco.core.proxy.ProxyConstants import com.willfp.eco.util.StringUtils +import com.willfp.ecoenchants.proxy.proxies.OpenInventoryProxy import org.bukkit.ChatColor import org.bukkit.Material import org.bukkit.entity.Player @@ -56,14 +57,9 @@ class AnvilSupport( fun onAnvilPrepare(@NotNull event: PrepareAnvilEvent) { val player = event.viewers.getOrNull(0) as? Player ?: return - // TODO: Implement proxies - /* - if (this.getPlugin().getProxy(OpenInventoryProxy::class.java).getOpenInventory(player).getClass().toString() - .equals(ANVIL_GUI_CLASS) - ) { + if (this.plugin.getProxy(OpenInventoryProxy::class.java).getOpenInventory(player)::class.java.toString() == anvilGuiClass) { return } - */ if (antiRepeat.contains(player.uniqueId)) { return diff --git a/eco-core/core-plugin/src/main/resources/vanillaenchants.yml b/eco-core/core-plugin/src/main/resources/vanillaenchants.yml index 49c5aa16..5447346c 100644 --- a/eco-core/core-plugin/src/main/resources/vanillaenchants.yml +++ b/eco-core/core-plugin/src/main/resources/vanillaenchants.yml @@ -1,11 +1,17 @@ # Rarity option does not affect vanilla enchantments. # The option is there for the display option to sort by rarity. +# If you enable custom max levels for a vanilla enchant you have to also specify conflicts, +# if you don't the enchantment will have no conflicts at all, and vice-versa; changing conflicts +# will require you to specify the max level. + protection: name: "Protection" description: Reduces most types of damage. type: normal rarity: common + #max-level: 6 # Custom max level to override for the enchantment. Raise it, but lowering it may cause bugs. + #conflicts: [] # Custom conflicts to override for the enchantment. Add or remove conflicts as you please. fire_protection: name: "Fire Protection" diff --git a/eco-core/core-proxy/build.gradle b/eco-core/core-proxy/build.gradle new file mode 100644 index 00000000..4f4dfcf1 --- /dev/null +++ b/eco-core/core-proxy/build.gradle @@ -0,0 +1,6 @@ +group 'com.willfp' +version rootProject.version + +dependencies { + compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT' +} diff --git a/eco-core/core-proxy/src/main/kotlin/com/willfp/ecoenchants/proxy/proxies/EcoCraftEnchantmentManagerProxy.kt b/eco-core/core-proxy/src/main/kotlin/com/willfp/ecoenchants/proxy/proxies/EcoCraftEnchantmentManagerProxy.kt new file mode 100644 index 00000000..143b327d --- /dev/null +++ b/eco-core/core-proxy/src/main/kotlin/com/willfp/ecoenchants/proxy/proxies/EcoCraftEnchantmentManagerProxy.kt @@ -0,0 +1,8 @@ +package com.willfp.ecoenchants.proxy.proxies + +import org.bukkit.NamespacedKey +import org.bukkit.enchantments.Enchantment + +interface EcoCraftEnchantmentManagerProxy { + fun registerNewCraftEnchantment(enchantment: Enchantment, maxLevel: Int, conflicts: Collection) +} diff --git a/eco-core/core-proxy/src/main/kotlin/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.kt b/eco-core/core-proxy/src/main/kotlin/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.kt new file mode 100644 index 00000000..0cbd9f34 --- /dev/null +++ b/eco-core/core-proxy/src/main/kotlin/com/willfp/ecoenchants/proxy/proxies/OpenInventoryProxy.kt @@ -0,0 +1,7 @@ +package com.willfp.ecoenchants.proxy.proxies + +import org.bukkit.entity.Player + +interface OpenInventoryProxy { + fun getOpenInventory(player: Player): Any +} diff --git a/settings.gradle b/settings.gradle index 926a4bfb..48fa2e51 100644 --- a/settings.gradle +++ b/settings.gradle @@ -2,4 +2,10 @@ rootProject.name = 'EcoEnchants' // Core include ':eco-core' -include ':eco-core:core-plugin' \ No newline at end of file +include ':eco-core:core-plugin' +include ':eco-core:core-proxy' +include ':eco-core:core-nms' +include ':eco-core:core-nms:v1_17_R1' +include ':eco-core:core-nms:v1_18_R1' +include ':eco-core:core-nms:v1_18_R2' +include ':eco-core:core-nms:v1_19_R1' \ No newline at end of file