Skip to content

Commit

Permalink
Added this_item filter
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jan 6, 2024
1 parent 74ed82c commit 627b31b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
2 changes: 2 additions & 0 deletions core/src/main/kotlin/com/willfp/libreforge/filters/Filters.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import com.willfp.libreforge.filters.impl.FilterPotionEffect
import com.willfp.libreforge.filters.impl.FilterProjectiles
import com.willfp.libreforge.filters.impl.FilterText
import com.willfp.libreforge.filters.impl.FilterTextContains
import com.willfp.libreforge.filters.impl.FilterThisItem
import com.willfp.libreforge.filters.impl.FilterValueAbove
import com.willfp.libreforge.filters.impl.FilterValueBelow
import com.willfp.libreforge.filters.impl.FilterValueEquals
Expand Down Expand Up @@ -116,5 +117,6 @@ object Filters : Registry<Filter<*, *>>() {
register(FilterValueBelow)
register(FilterIsExpressionTrue)
register(FilterAdvancements)
register(FilterThisItem)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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.getProvider
import com.willfp.libreforge.triggers.TriggerData

object FilterThisItem : Filter<NoCompileData, Boolean>("this_item") {
override fun getValue(config: Config, data: TriggerData?, key: String): Boolean {
return config.getBool(key)
}

override fun isMet(data: TriggerData, value: Boolean, compileData: NoCompileData): Boolean {
return data.item == data.holder.getProvider()
}
}

0 comments on commit 627b31b

Please sign in to comment.