-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
core/common/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterSwept.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.willfp.libreforge.filters.impl | ||
|
||
import com.willfp.eco.core.config.interfaces.Config | ||
import com.willfp.libreforge.NoCompileData | ||
import com.willfp.libreforge.filters.Filter | ||
import com.willfp.libreforge.triggers.TriggerData | ||
import org.bukkit.event.entity.EntityDamageEvent | ||
|
||
object FilterSwept : Filter<NoCompileData, Boolean>("swept") { | ||
override fun getValue(config: Config, data: TriggerData?, key: String): Boolean { | ||
return config.getBool(key) | ||
} | ||
|
||
override fun isMet(data: TriggerData, value: Boolean, compileData: NoCompileData): Boolean { | ||
val cause = (data.event as? EntityDamageEvent)?.cause ?: return true | ||
return cause == EntityDamageEvent.DamageCause.ENTITY_SWEEP_ATTACK == value | ||
} | ||
} |