diff --git a/core/src/main/kotlin/com/willfp/libreforge/filters/Filters.kt b/core/src/main/kotlin/com/willfp/libreforge/filters/Filters.kt index ea0a67800..8fc2c0a02 100644 --- a/core/src/main/kotlin/com/willfp/libreforge/filters/Filters.kt +++ b/core/src/main/kotlin/com/willfp/libreforge/filters/Filters.kt @@ -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 @@ -116,5 +117,6 @@ object Filters : Registry>() { register(FilterValueBelow) register(FilterIsExpressionTrue) register(FilterAdvancements) + register(FilterThisItem) } } diff --git a/core/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterThisItem.kt b/core/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterThisItem.kt new file mode 100644 index 000000000..0e38a5943 --- /dev/null +++ b/core/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterThisItem.kt @@ -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("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() + } +}