Event Bus
XDiscordUltimate ships its own lightweight event bus:com.xreatlabs.xdiscordultimate.events.XDiscordEventBus. It is not the Bukkit event system — there are no @EventHandler annotations, no Listener interface, and events do not extend Event. Listeners are plain objects and events are plain POJOs.
How Dispatch Works
The bus keeps aCopyOnWriteArrayList of listeners. When you call publish(event), it reflects over each listener’s declared methods and invokes any method that takes a single argument isInstance(event):
- A listener is any object with one-argument methods named however you like.
- Method name and annotations are ignored — only the parameter type matters.
- Private methods are called (the bus calls
setAccessible(true)). - Multiple methods accepting the same event type are all invoked.
API
Listening for Verification
The built-in events arePlayerVerifiedEvent and PlayerUnlinkedEvent. Register your listener object in onEnable, unregister it in onDisable:
PlayerVerifiedEvent Fields
| Getter | Type | Description |
|---|---|---|
getPlayerUuid() | UUID | Minecraft UUID |
getPlayerName() | String | Minecraft username |
getDiscordId() | String | Discord snowflake |
getDiscordUsername() | String | Discord display name |
getTimestamp() | long | Epoch ms when the event fired |
Publishing Your Own Events
Any POJO works. Construct it, publish it, and every registered listener with a matching single-argument method receives it:Dispatch is synchronous and runs on whatever thread called
publish. Keep handlers fast — no database queries, no blocking I/O, no HTTP. If a handler needs to do slow work, hand it off to your own async task inside the handler and return immediately.Next Steps
Database API
Look up linked accounts when an event fires.
Modules
Build a full module on top of the event bus and services.

