diff --git a/core/common/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterSpawnerEntity.kt b/core/common/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterSpawnerEntity.kt index 9f199045..8ecd6473 100644 --- a/core/common/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterSpawnerEntity.kt +++ b/core/common/src/main/kotlin/com/willfp/libreforge/filters/impl/FilterSpawnerEntity.kt @@ -8,21 +8,16 @@ import com.willfp.libreforge.triggers.TriggerData import org.bukkit.block.CreatureSpawner object FilterSpawnerEntity : Filter>("spawner_entity") { - override fun getValue(config: Config, data: TriggerData?, key: String): Collection { return config.getStrings(key) } override fun isMet(data: TriggerData, value: Collection, compileData: NoCompileData): Boolean { - val block = data.block ?: return false - - if (block.state is CreatureSpawner) { - val spawner = block.state as CreatureSpawner - val spawnerEntityType = spawner.spawnedType?.name ?: "null" + val block = data.block ?: return true + val state = block.state as? CreatureSpawner ?: return false - return value.containsIgnoreCase(spawnerEntityType) - } + val spawnerEntityType = state.spawnedType?.name ?: "null" - return false + return value.containsIgnoreCase(spawnerEntityType) } -} \ No newline at end of file +}