ba82e8d
Branches > main > ba82e8d > files / src / main / kotlin / net / bowmap / server
Effect docs
Commit: ba82e8d958d1a4901b776f30dc895eb77d04a303
Parent: ad6f0ad
1 changed file:
src/main/kotlin/net/bowmap/stormbow/effect/Effect.kt view file
@@ -2,10 +2,11 @@ import kotlinx.collections.immutable.* -interface Effect {-}+/// An effect is a piece of data representing a side effect that can be executed,+/// such as with a Bukkit API call+interface Effect -/// An effect that knows how to run itself.+/// An effect that knows how to execute itself. /// Some effects are to be run by event listeners themselves interface DefaultEffect : Effect { fun execute()@@ -21,10 +22,12 @@ fun effects(vararg e: Effect) = persistentListOf(*e) +/// Returns a the first effect of type T in the list effects inline fun <reified T : Effect> find(effects: PersistentList<Effect>): T? { return effects.filterIsInstance<T>().firstOrNull() } +/// Returns whether an effect of type T exists in the list of effects inline fun <reified T : Effect> contains(effects: PersistentList<Effect>): Boolean { return effects.any {it is T} }