Developer guide
Loading Conduit, resolving items, subscribing to normalised events, and reading coverage.
Conduit is consumed from a plugin. There is no server-side configuration.
repositories {
maven { url = uri("https://repo.homestead.systems/snapshots") }
}
dependencies {
implementation("systems.homestead.conduit:conduit-core:0.1.0-SNAPSHOT")
}conduit-core brings conduit-api transitively. Depend on conduit-api alone
only if you are implementing ItemProvider and nothing else.
Loading it
Conduit conduit = ConduitLoader.load(this);Always pass your Plugin. The no-argument load() finds providers through
the calling classloader, which works but leaves the bus without an owner to
register against and to attribute lifecycle to. load(Plugin) is the supported
form.
Other entry points exist for tests:
| Call | Use |
|---|---|
ConduitLoader.load(Plugin) |
Normal use. The bus is owned by your plugin. |
ConduitLoader.load() |
Finds providers through the caller's classloader, unowned. |
ConduitLoader.load(ClassLoader) |
Explicit classloader. |
ConduitLoader.of(ItemProvider...) |
A hand-built provider set, no discovery. Useful in tests. |
ConduitLoader.of(List<ItemProvider>) |
Same, from a list. |
Readiness
Providers become ready at different times, and "the plugin is enabled" does not mean "its registry is populated". Subscribe to readiness rather than guessing:
conduit.events().onPluginReady(event -> {
getLogger().info(event.source().id() + " is ready ("
+ (event.isFirstLoad() ? "first load" : "reload") + ")");
});Readiness fires during startup and can arrive before your onEnable if you
declare the wrong dependencies. Conduit replays missed first-loads to late
subscribers, so subscribing in onEnable is correct in the usual case.
Four of the fifteen providers ship no readiness event at all and one ships a
"reload notification" that does not extend Event; those report
ProviderStatus.NO_EVENTS and are polled instead. See
Diagnostics.
The two APIs
| Item resolution | conduit.resolve(...) — turn a stack into an Item, or an id into one. |
| Events | conduit.events() — subscribe to normalised provider events. |
Event normalisation is additive. The provider lookup API predates it and is unchanged.
Contents
- Events — the four event types, cancellation, and threads
- Item resolution —
Item,ItemKey,ItemProvider - Coverage — exactly what is forwarded, and what is not
- Diagnostics — what is happening right now
- Architecture — how the bindings are built