Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Nov 20, 2021
1 parent 8d1532d commit 9438c2f
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions eco-api/src/main/kotlin/com/willfp/libreforge/LibReforge.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.willfp.libreforge.integrations.aureliumskills.AureliumSkillsIntegrati
import com.willfp.libreforge.integrations.ecoskills.EcoSkillsIntegration
import com.willfp.libreforge.triggers.Triggers
import org.apache.commons.lang.StringUtils
import org.bukkit.Bukkit
import org.bukkit.entity.Player
import java.util.*

Expand Down Expand Up @@ -46,6 +47,17 @@ object LibReforge {
}
}

@JvmStatic
fun disable(plugin: EcoPlugin) {
for (player in Bukkit.getOnlinePlayers()) {
for (holder in player.getHolders()) {
for ((effect) in holder.effects) {
effect.disableForPlayer(player)
}
}
}
}

@JvmStatic
fun getIntegrationLoaders(): List<IntegrationLoader> {
return listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class EffectDamageMultiplier : Effect(
val event = data.event as? WrappedDamageEvent ?: return

event.damage *= config.getDouble("multiplier")

if (event.damage < 0.01) {
event.isCancelled = true
}
}

override fun validateConfig(config: JSONConfig): List<ConfigViolation> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,12 @@ class WrappedDamageEvent(
set(value) {
event.damage = value
}
}

var isCancelled: Boolean
get() {
return event.isCancelled
}
set(value) {
event.isCancelled = value
}
}

0 comments on commit 9438c2f

Please sign in to comment.