Skip to content

Architecture

How Conduit is put together — modules, bindings, and why a broken provider degrades instead of throwing.

Conduit is a library loaded through ServiceLoader, not a Bukkit JavaPlugin. It has no plugin.yml and is never enabled by the server; the plugin that depends on it owns its lifecycle.

Modules

Module What it is
conduit-api The public surface. Types only — no Bukkit implementation detail.
conduit-core Discovery, the event bus, and the provider bindings.
conduit-integration:* One module per provider, so a missing provider is a missing class rather than a failed branch.

Depend on conduit-core; it brings the rest.

Discovery

ConduitLoader.load(Plugin) resolves providers through ServiceLoader, each one isolated. A provider whose plugin is not installed, whose class fails to link, or whose API does not match the version Conduit was built against is recorded and skipped — it never propagates out of discovery.

That is the design rule the whole library follows: a third-party plugin's mistake must not become your exception. The worst case is a provider that reports LINKAGE_FAILED and is otherwise inert.

The event bus

EventBus owns one handler registration per bound provider event, registers them at EventPriority.MONITOR with ignoreCancelled off, and republishes.

Why MONITOR — so Conduit sees a provider's event after every other plugin has had its turn, and a consumer's HIGH decision is included rather than overwritten.

Why ignoreCancelled off — cancellation is decided by Conduit's own subscribers. If the registration short-circuited on a consumer's decision, the write-back to the provider would never happen.

The bus publishes, then calls applyCancellation() once every subscriber has run. Write-back happens on the provider's event, on the provider's thread — which is correct, because the provider's event is the thing that was already async if anything was.

Degradation, not failure

Every binding has a defined way to fail:

Problem Result
Provider plugin absent ProviderStatus.ABSENT
Event class does not extend Event NO_EVENTS, and readiness is polled
getHandlerList() missing or non-static LINKAGE_FAILED, naming the class
Translation throws Counted as untranslatable, the adapter named, other providers unaffected
Event fires but data is unreadable Nothing is published — never a fabricated value

The last row is a hard rule. Where a provider's event does not carry enough to build a truthful payload, Conduit publishes nothing rather than inventing an entity, a player, a location or a stack.

Adding a provider

  1. Add a conduit-integration:<name> module.
  2. Implement the provider's ItemProvider.
  3. Declare a binding table: source event class → which Conduit event and kind.
  4. Record every event you deliberately skip, with a reason, in the coverage table.

Step 4 is not bookkeeping. A binding table that lists only what it forwards is indistinguishable from one that quietly ignores things, and the coverage query is the only way a consumer can tell the difference.

Further reading