EventScope

class EventScope<T : Event>(val filters: MutableList<(T) -> Boolean> = mutableListOf())

Defines a scope for filtering events based on various criteria.

This class provides a set of functions to filter events based on conditions like player names, permissions, world names, metadata, and more. It allows building complex event filters.

Constructors

Link copied to clipboard
constructor(filters: MutableList<(T) -> Boolean> = mutableListOf())

Types

Link copied to clipboard
object Companion

Companion object for creating an instance of EventScope.

Properties

Link copied to clipboard

Functions

Link copied to clipboard
fun custom(block: (T) -> Boolean): EventScope<T>

Adds a custom condition to the scope.

Link copied to clipboard
fun meta(key: String): EventScope<T>

Adds a condition that checks if the event has metadata for a given key.

Link copied to clipboard
fun metaMatch(key: String, test: (Any?) -> Boolean): EventScope<T>

Adds a condition that checks if the metadata value for a given key matches a specified test.

Link copied to clipboard
fun negate(scopeFunction: EventScope<T>.() -> Unit): EventScope<T>

Negates the condition defined in the provided scopeFunction.

Link copied to clipboard

Adds a condition that checks if the player is not an operator.

Link copied to clipboard

Adds a condition that checks if the event is not paused based on a given key.

Link copied to clipboard

Adds a condition that checks if the event did not occur in the specified world.

Link copied to clipboard
fun oneOfPlayers(vararg names: String): EventScope<T>

Adds a condition that checks if the event was triggered by any of the specified player names.

fun oneOfPlayers(vararg players: Player): EventScope<T>

Adds a condition that checks if the event was triggered by any of the specified players.

Link copied to clipboard
fun op(): EventScope<T>

Adds a condition that checks if the player is an operator.

Link copied to clipboard

Adds a condition that checks if the event is paused based on a given key.

Link copied to clipboard
fun permission(permission: String): EventScope<T>

Adds a condition that checks if the player involved in the event has the specified permission.

Link copied to clipboard
fun permissionsAll(vararg permissions: String): EventScope<T>

Adds a condition that checks if the player has all of the specified permissions.

Link copied to clipboard
fun permissionsOne(vararg permissions: String): EventScope<T>

Adds a condition that checks if the player has at least one of the specified permissions.

Link copied to clipboard
fun player(name: String): EventScope<T>

Adds a condition that checks if the event was triggered by a player with the specified name.

fun player(player: Player): EventScope<T>

Adds a condition that checks if the event was triggered by a specific player.

Link copied to clipboard
fun scope(block: (T) -> Boolean): EventScope<T>

Adds a condition to the scope.

Link copied to clipboard
fun test(event: T): Boolean

Evaluates whether the event passes all filters defined in the scope.

Link copied to clipboard

Applies an event template with the specified name.

Link copied to clipboard
fun world(name: String): EventScope<T>

Adds a condition that checks if the event occurred in the specified world.