Skip to content

Commit

Permalink
Cleaned up spawner_entity
Browse files Browse the repository at this point in the history
  • Loading branch information
WillFP committed Jul 25, 2024
1 parent 2ec6e8f commit cad7471
Showing 1 changed file with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,16 @@ import com.willfp.libreforge.triggers.TriggerData
import org.bukkit.block.CreatureSpawner

object FilterSpawnerEntity : Filter<NoCompileData, Collection<String>>("spawner_entity") {

override fun getValue(config: Config, data: TriggerData?, key: String): Collection<String> {
return config.getStrings(key)
}

override fun isMet(data: TriggerData, value: Collection<String>, 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)
}
}
}

0 comments on commit cad7471

Please sign in to comment.