Skip to main content
RefineryBus (xyz.refineryteam.refinerycore.api.event) is a process-wide, string-keyed publish/subscribe bus for lightweight cross-plugin signaling. Unlike Bukkit events, channels are just strings, so one plugin can publish on a channel and another can subscribe to it without either plugin depending on the other’s classes at compile time.
This is meant for lightweight signaling — notify, refresh, sync. For anything that needs to be cancellable or intercepted mid-flow, use a real Bukkit Event instead.

Publishing

EconomyManager.java
Delivery is synchronous, on the calling thread, in subscriber priority order (highest first). A throwing subscriber doesn’t prevent others on the same channel from receiving the payload — the exception is logged and swallowed.

Subscribing

EconomyManager.java
Only payloads assignable to the given type are delivered to that subscriber, so multiple unrelated payload shapes can technically share a channel name (though using separate channel names per payload shape is usually clearer).
RefineryBus.java
subscribe returns a UUID handle you can pass to unsubscribe(channel, id) later. Payloads are plain objects — records work well — shared by convention: both the publisher and subscriber need to agree on the payload’s shape, typically documented per channel name or via a small shared “API” module.

Cleaning up — BusSubscriptions

Manually tracking every subscription UUID to unsubscribe them on plugin disable is tedious, so BusSubscriptions groups them for you:
MyPlugin.java
Always call unsubscribeAll() (or manually unsubscribe) in onDisable(). Since RefineryBus is a JVM-wide singleton, stale subscriptions from a disabled or reloaded plugin will otherwise keep firing against a plugin instance that’s no longer active.

Other operations