Updated to use new libreforge features

This commit is contained in:
Auxilor 2023-03-18 15:12:30 +00:00
parent fdc3bdb236
commit 9353dc601b
2 changed files with 6 additions and 3 deletions

View File

@ -20,7 +20,9 @@ import com.willfp.ecoenchants.type.EnchantmentTypes
import com.willfp.libreforge.ViolationContext
import com.willfp.libreforge.conditions.ConditionList
import com.willfp.libreforge.conditions.Conditions
import com.willfp.libreforge.conditions.emptyConditionList
import com.willfp.libreforge.effects.EffectList
import com.willfp.libreforge.effects.emptyEffectList
import net.kyori.adventure.text.Component
import org.bukkit.Bukkit
import org.bukkit.Material
@ -128,7 +130,7 @@ abstract class EcoEnchant(
conditions = if (plugin.isLoaded) Conditions.compile(
config.getSubsections("conditions"),
ViolationContext(plugin, "Enchantment $id")
) else ConditionList(emptyList())
) else emptyConditionList()
if (Bukkit.getPluginManager().getPermission("ecoenchants.fromtable.$id") == null) {
val permission = Permission(
@ -197,7 +199,7 @@ abstract class EcoEnchant(
}
open fun createLevel(level: Int) =
EcoEnchantLevel(this, level, EffectList(emptyList()), conditions, plugin)
EcoEnchantLevel(this, level, emptyEffectList(), conditions, plugin)
fun registerListener(listener: Listener) {
this.plugin.eventManager.registerListener(listener)

View File

@ -7,6 +7,7 @@ import com.willfp.libreforge.ViolationContext
import com.willfp.libreforge.conditions.ConditionList
import com.willfp.libreforge.effects.EffectList
import com.willfp.libreforge.effects.Effects
import com.willfp.libreforge.effects.emptyEffectList
import com.willfp.libreforge.loader.LibreforgePlugin
import java.util.Objects
@ -25,7 +26,7 @@ class LibReforgeEcoEnchant(
effects = if (plugin.isLoaded) Effects.compile(
config.getSubsections("effects"),
ViolationContext(plugin, "Enchantment $id")
) else EffectList(emptyList())
) else emptyEffectList()
}
override fun createLevel(level: Int): EcoEnchantLevel =