Skip to content

Commit

Permalink
Renamed new stat conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Dec 11, 2023
1 parent 6caabf9 commit 5fde2bc
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.willfp.ecoskills

import com.willfp.eco.core.command.impl.PluginCommand
import com.willfp.eco.core.packet.PacketListener
import com.willfp.eco.util.containsIgnoreCase
import com.willfp.ecoskills.actionbar.ActionBarCompatibilityProxy
import com.willfp.ecoskills.actionbar.ActionBarGamemodeListener
import com.willfp.ecoskills.actionbar.ActionBarHandler
Expand Down Expand Up @@ -30,7 +29,6 @@ import com.willfp.libreforge.conditions.Conditions
import com.willfp.libreforge.filters.Filters
import com.willfp.libreforge.loader.LibreforgePlugin
import com.willfp.libreforge.loader.configs.ConfigCategory
import com.willfp.libreforge.registerHolderProvider
import com.willfp.libreforge.registerSpecificHolderProvider
import com.willfp.libreforge.triggers.Triggers
import org.bukkit.entity.Player
Expand Down Expand Up @@ -73,8 +71,8 @@ class EcoSkillsPlugin : LibreforgePlugin() {
com.willfp.libreforge.effects.Effects.register(EffectAddStatTemporarily(this))
com.willfp.libreforge.effects.Effects.register(EffectMultiplyStatTemporarily(this))
com.willfp.libreforge.effects.Effects.register(EffectMagicRegenMultiplier)
Conditions.register(ConditionAboveStat)
Conditions.register(ConditionBelowStat)
Conditions.register(ConditionStatAbove)
Conditions.register(ConditionStatBelow)
Conditions.register(ConditionStatEquals)
Conditions.register(ConditionHasSkillLevel)
Conditions.register(ConditionBelowMagic)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.willfp.ecoskills.libreforge

import com.willfp.eco.core.config.interfaces.Config
import com.willfp.ecoskills.api.getMagic
import com.willfp.ecoskills.api.getStatLevel
import com.willfp.ecoskills.magic.MagicTypes
import com.willfp.ecoskills.stats.Stats
import com.willfp.libreforge.Dispatcher
import com.willfp.libreforge.NoCompileData
Expand All @@ -13,10 +11,10 @@ import com.willfp.libreforge.conditions.Condition
import com.willfp.libreforge.get
import org.bukkit.entity.Player

object ConditionAboveStat : Condition<NoCompileData>("above_stat") {
object ConditionStatAbove : Condition<NoCompileData>("stat_above") {
override val arguments = arguments {
require("stat", "You must specify the stat!")
require("amount", "You must specify the amount!")
require("level", "You must specify the level!")
}

override fun isMet(
Expand All @@ -29,6 +27,6 @@ object ConditionAboveStat : Condition<NoCompileData>("above_stat") {

val type = Stats.getByID(config.getString("stat").lowercase()) ?: return false

return player.getStatLevel(type) >= config.getIntFromExpression("amount", player)
return player.getStatLevel(type) >= config.getIntFromExpression("level", player)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.willfp.ecoskills.libreforge

import com.willfp.eco.core.config.interfaces.Config
import com.willfp.ecoskills.api.getMagic
import com.willfp.ecoskills.api.getStatLevel
import com.willfp.ecoskills.magic.MagicTypes
import com.willfp.ecoskills.stats.Stats
import com.willfp.libreforge.Dispatcher
import com.willfp.libreforge.NoCompileData
Expand All @@ -13,10 +11,10 @@ import com.willfp.libreforge.conditions.Condition
import com.willfp.libreforge.get
import org.bukkit.entity.Player

object ConditionBelowStat : Condition<NoCompileData>("below_stat") {
object ConditionStatBelow : Condition<NoCompileData>("stat_below") {
override val arguments = arguments {
require("stat", "You must specify the stat!")
require("amount", "You must specify the amount!")
require("level", "You must specify the level!")
}

override fun isMet(
Expand All @@ -29,6 +27,6 @@ object ConditionBelowStat : Condition<NoCompileData>("below_stat") {

val type = Stats.getByID(config.getString("stat").lowercase()) ?: return false

return player.getStatLevel(type) < config.getIntFromExpression("amount", player)
return player.getStatLevel(type) < config.getIntFromExpression("level", player)
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package com.willfp.ecoskills.libreforge

import com.willfp.eco.core.config.interfaces.Config
import com.willfp.ecoskills.api.getMagic
import com.willfp.ecoskills.api.getStatLevel
import com.willfp.ecoskills.magic.MagicTypes
import com.willfp.ecoskills.stats.Stats
import com.willfp.libreforge.Dispatcher
import com.willfp.libreforge.NoCompileData
Expand All @@ -16,7 +14,7 @@ import org.bukkit.entity.Player
object ConditionStatEquals : Condition<NoCompileData>("stat_equals") {
override val arguments = arguments {
require("stat", "You must specify the stat!")
require("amount", "You must specify the amount!")
require("level", "You must specify the level!")
}

override fun isMet(
Expand Down

0 comments on commit 5fde2bc

Please sign in to comment.