Class PanelMessageEvent

java.lang.Object
com.ultikits.ultitools.events.ModuleEvent
com.ultikits.ultitools.events.PanelMessageEvent

public final class PanelMessageEvent extends ModuleEvent
Published once for every inbound panel message the framework has already handled. As of 6.3.1 (UltiCloud protocol v2) that is one event per module.request that reached a module's responder, published after the request was handed to it, with the module's responder key (<module>.<action>) as the type; the protocol v1 inbound dispatch that also published it was removed in 6.3.1. A module subscribes to this event on the existing EventBus to observe panel traffic without the framework growing a second, module-visible protocol surface.

This event deliberately does not implement Cancellable. Cancellation is only meaningful before an outcome has been decided; this event is published after the framework has already handled the message, so a cancel flag here would be a callable method with no observable effect — exactly the "declared but does not do what it declares" defect class this milestone (6.3.0) exists to remove. This is consistent with an existing in-repo contract rather than an isolated exception: EventBus.publishAsync(ModuleEvent) already rejects any Cancellable event outright, for the same underlying reasoning that cancellation requires synchronous dispatch before the result is settled.

Handlers run on the main server thread — the publish site wraps EventBus.publish(com.ultikits.ultitools.events.ModuleEvent) in Bukkit.getScheduler().runTask(...) — so a handler may use Bukkit API freely. That same hop means a slow handler occupies a server tick; the publish site logs one warning per slow publish naming the elapsed time.

The data and raw envelope this event carries are defensive copies, taken both when the event is constructed and again on every accessor call: this event crosses a thread hop and is delivered to an unknown number of third-party handlers, and one handler mutating shared state must not change what the next handler sees or what the framework already acted on.

Since:
6.3.0
  • Field Details

    • type

      private final String type
    • data

      private final com.google.gson.JsonObject data
    • rawMessage

      private final com.google.gson.JsonObject rawMessage
  • Constructor Details

    • PanelMessageEvent

      public PanelMessageEvent(String type, com.google.gson.JsonObject data, com.google.gson.JsonObject rawMessage)
      Parameters:
      type - the panel message's type field; must not be null or empty
      data - the message's data object; null becomes a non-null empty object
      rawMessage - the full inbound envelope; null becomes a non-null empty object
      Throws:
      IllegalArgumentException - if type is null or empty
  • Method Details

    • getType

      public String getType()
      Returns:
      the panel message's type field; never null or empty
    • getData

      public com.google.gson.JsonObject getData()
      Returns:
      a defensive copy of the message's data object; never null
    • getRawMessage

      public com.google.gson.JsonObject getRawMessage()
      Returns:
      a defensive copy of the full inbound envelope; never null