Interface ContextUpdateEvent

All Superinterfaces:
LuckPermsEvent

public interface ContextUpdateEvent extends LuckPermsEvent
Called when a subject's current/active contexts are updated.

There are no guarantees that this event will be called for every update. It is merely to be used as a "hint" for plugins which depend on the current active contexts for a player.

It will always be fired following a call to ContextManager.signalContextUpdate(Object).

The subject is always an instance of the platform's subject type. See ContextManager for details.

Unlike most other LuckPerms events, this event is not fired asynchronously. Care should be taken to ensure listeners are lightweight. Additionally, listeners should ensure they do not cause further updates to player context, thus possibly causing a stack overflow.

Since:
5.2
  • Method Details

    • getSubject

      @NonNull Object getSubject()
      Gets the subject whose contexts were updated.
      Returns:
      the subject
    • getSubject

      default <T> @NonNull Optional<T> getSubject(@NonNull Class<T> subjectClass)
      Gets the subject whose contexts were updated, casted to a given type.
      Type Parameters:
      T - the subject type
      Parameters:
      subjectClass - the type to cast to
      Returns:
      the casted subject