Package org.spongepowered.api.event
Interface CauseStackManager.StackFrame
- All Superinterfaces:
AutoCloseable
- Enclosing interface:
- CauseStackManager
-
Method Summary
Modifier and TypeMethodDescriptiondefault <T> CauseStackManager.StackFrame
addContext
(Supplier<EventContextKey<T>> key, Supplier<? extends T> value) Adds the given object to the current context under the given key.default <T> CauseStackManager.StackFrame
addContext
(Supplier<EventContextKey<T>> key, T value) Adds the given object to the current context under the given key.default <T> CauseStackManager.StackFrame
addContext
(EventContextKey<T> key, Supplier<? extends T> value) Adds the given object to the current context under the given key.addContext
(EventContextKey<T> key, T value) Adds the given object to the current context under the given key.void
close()
Gets the currentCause
object from the current cause stack.Gets anEventContext
object on the current contextual information.popCause()
Pops the most recently pushed cause object off of the stack and returns it.Pushes an object to the current cause stack which will associate it with all events through from api actions until it is popped off again.default <T> Optional<T>
removeContext
(Supplier<EventContextKey<T>> key) Removes the given context key from the current context.<T> Optional<T>
removeContext
(EventContextKey<T> key) Removes the given context key from the current context.
-
Method Details
-
currentCause
Cause currentCause()Gets the currentCause
object from the current cause stack.- Returns:
- A cause of the current stack.
- See Also:
-
currentContext
EventContext currentContext()Gets anEventContext
object on the current contextual information.- Returns:
- The current event context
- See Also:
-
pushCause
Pushes an object to the current cause stack which will associate it with all events through from api actions until it is popped off again.- Parameters:
obj
- The object to push to the stack- Returns:
- The stack frame, for chaining
- See Also:
-
popCause
Object popCause()Pops the most recently pushed cause object off of the stack and returns it.- Returns:
- The last pushed object
- See Also:
-
addContext
Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
-
addContext
default <T> CauseStackManager.StackFrame addContext(EventContextKey<T> key, Supplier<? extends T> value) Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
-
addContext
Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
-
addContext
default <T> CauseStackManager.StackFrame addContext(Supplier<EventContextKey<T>> key, Supplier<? extends T> value) Adds the given object to the current context under the given key.- Type Parameters:
T
- The type of value key- Parameters:
key
- The context keyvalue
- The object- Returns:
- The stack frame, for chaining
- See Also:
-
removeContext
Removes the given context key from the current context.- Type Parameters:
T
- The type of value key- Parameters:
key
- The key to clear- Returns:
- The existing context value, if it was present
- See Also:
-
removeContext
Removes the given context key from the current context.- Type Parameters:
T
- The type of value key- Parameters:
key
- The key to clear- Returns:
- The existing context value, if it was present
- See Also:
-
close
void close()- Specified by:
close
in interfaceAutoCloseable
-