Interface EventBus


public interface EventBus
The event bus is responsible for posting gaia events.
  • Method Details

    • shutdown

      void shutdown()
      Close this event bus preventing any further events from being posted.
    • subscribe

      default <T extends GaiaEvent> void subscribe(Class<T> event, Consumer<? super T> subscriber)
      Registers the given subscriber to receive events.
      Type Parameters:
      T - the event type
      Parameters:
      event - the event type
      subscriber - the subscriber
      See Also:
    • subscribe

      <T extends GaiaEvent> void subscribe(Class<T> event, Consumer<? super T> subscriber, int priority)
      Registers the given subscriber to receive events.
      Type Parameters:
      T - the event type
      Parameters:
      event - the event type
      subscriber - the subscriber
      priority - the subscriber's priority, default priority is 0
    • post

      <T extends GaiaEvent> boolean post(T event)
      Post an event.
      Type Parameters:
      T - the type of event
      Parameters:
      event - the event to post
      Returns:
      true if the event was successfully posted, false otherwise
    • postArenaAnalyzeEvent

      ArenaAnalyzeEvent postArenaAnalyzeEvent(Arena arena, long time)
      Posts a new ArenaAnalyzeEvent.
      Parameters:
      arena - the arena that was being analyzed
      time - the amount of time it took to analyze the arena in milliseconds
    • postArenaRevertEvent

      ArenaRevertEvent postArenaRevertEvent(Arena arena, long time, boolean completed)
      Posts a new ArenaRevertEvent.
      Parameters:
      arena - the arena that was being reverted
      time - the amount of time it took to revert the arena in milliseconds
      completed - whether reverting was successful and operation has completed
    • postChunkAnalyzeEvent

      ChunkAnalyzeEvent postChunkAnalyzeEvent(ChunkRegion chunkRegion, net.kyori.adventure.key.Key level, long time)
      Posts a new ChunkAnalyzeEvent.
      Parameters:
      chunkRegion - the chunk that was analyzed
      level - level key
      time - the amount of time it took to analyze the chunk in milliseconds
    • postChunkRevertEvent

      ChunkRevertEvent postChunkRevertEvent(ChunkRegion chunkRegion, net.kyori.adventure.key.Key level, long time)
      Posts a new ChunkRevertEvent.
      Parameters:
      chunkRegion - the chunk that was reverted
      level - level key
      time - the amount of time it took to revert the chunk in milliseconds