Class PanelMessageEvent
PluginInitiationUtils#handleInboundMessage(JsonObject), after
the framework's own dispatch has completed. 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 Summary
FieldsModifier and TypeFieldDescriptionprivate final com.google.gson.JsonObjectprivate final com.google.gson.JsonObjectprivate final String -
Constructor Summary
ConstructorsConstructorDescriptionPanelMessageEvent(String type, com.google.gson.JsonObject data, com.google.gson.JsonObject rawMessage) -
Method Summary
-
Field Details
-
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'stypefield; must not benullor emptydata- the message'sdataobject;nullbecomes a non-null empty objectrawMessage- the full inbound envelope;nullbecomes a non-null empty object- Throws:
IllegalArgumentException- iftypeisnullor empty
-
-
Method Details
-
getType
- Returns:
- the panel message's
typefield; nevernullor empty
-
getData
public com.google.gson.JsonObject getData()- Returns:
- a defensive copy of the message's
dataobject; nevernull
-
getRawMessage
public com.google.gson.JsonObject getRawMessage()- Returns:
- a defensive copy of the full inbound envelope; never
null
-