diff --git a/README.md b/README.md
index f066bb9..3fc32c3 100644
--- a/README.md
+++ b/README.md
@@ -144,6 +144,7 @@ The full documentation index is in [`docs/README.md`](docs/README.md).
- `featureframework-bom` — one import for aligned framework artifact versions.
- `featureframework-api` — stable public runtime, feature metadata, and capability contracts.
+- `featureframework-hud-api` — immutable Adventure frames and a platform-neutral, expiring priority-lease coordinator; see [HUD ownership](docs/toolkits/HUD-OWNERSHIP.md).
- `featureframework-theme-api` — platform-neutral theme identifiers, colour operations, builders, and registry contracts.
- `featureframework-toolkit` — platform-neutral configuration, localization, cache, HTTP, text, and token utilities.
- `featureframework-core` — feature model, host/runtime, lifecycle, dependency loading, services, and resource ownership.
diff --git a/docs/toolkits/HUD-OWNERSHIP.md b/docs/toolkits/HUD-OWNERSHIP.md
new file mode 100644
index 0000000..045e87b
--- /dev/null
+++ b/docs/toolkits/HUD-OWNERSHIP.md
@@ -0,0 +1,26 @@
+# Shared HUD ownership
+
+`featureframework-hud-api` supplies `HudService`, immutable `HudFrame` values and the platform-independent `HudCoordinator`. Adventure is provided by the platform. The API has no Bukkit entities, worlds, scheduler, SQL or static runtime singleton.
+
+A host publishes `HudService` through its platform service boundary. ServerFeatures supplies the Paper host; other plugins acquire leases through the live service. Do not create a second shared coordinator when a host is already present. Producers must handle service replacement by closing old handles and acquiring new ones.
+
+```java
+var lease = hud.claim("MyPlugin:adventure", playerId, HudService.Channel.SIDEBAR,
+ HudService.SESSION, Duration.ofSeconds(10));
+lease.update(new HudFrame.Sidebar(Component.text("Adventure"), lines));
+lease.renew(Duration.ofSeconds(10));
+// On departure, release instead of restoring a captured old scoreboard:
+lease.close();
+```
+
+Channels are sidebar, action bar, boss bar and title. Priorities are ambient (0), session (100), contextual (200), and critical (300). Equal priorities retain acquisition order. A newly acquired null frame suppresses underlying content without drawing. Frames must match the lease channel. Sidebars are bounded to 15 lines and managed boss-bar frames to two bars; progress is finite and clamped to 0..1. Frame collections, including boss-bar flags, are defensively copied.
+
+All operations belong to the host owner thread. The coordinator accepts an injected thread check and monotonic clock. Hosts call `tick` to expire handles and request action-bar keepalive about once per second. Rendered equality suppresses unchanged writes. Title producers should use bounded lifetimes matching their display duration so stale titles do not reappear later.
+
+Owner names are plugin names, optionally followed by colon-separated feature scopes. `releaseOwner("MyPlugin")` also releases `MyPlugin:feature` scopes. Hosts release scopes on plugin disable and player quit, and close the coordinator on shutdown. Handles are idempotently closeable; a stale handle cannot renew, update or remove a newer claim. Releasing the winning claim reveals the latest lower-priority frame, including changes made while hidden.
+
+A renderer failure does not prevent other keys from being processed during a tick or shutdown. Errors are reported after that work. Hosts should isolate/throttle renderer error reporting. The renderer owns platform-side cleanup and must preserve unrelated teams/objectives.
+
+The Paper action-bar toolkit also accepts an injected `Delivery` transport carrying priority. Normal cycle frames use ambient priority and manual overrides use critical priority; the default constructor preserves raw Paper delivery for hosts without shared HUDs.
+
+Tests cover restoration of updated underlying content, suppression, expiry, stable ties, independent players, stale handles, keepalive/deduplication, failing renderers and a 100-player/10-run simulation.
diff --git a/featureframework-bom/pom.xml b/featureframework-bom/pom.xml
index 28077cd..8a9a383 100644
--- a/featureframework-bom/pom.xml
+++ b/featureframework-bom/pom.xml
@@ -6,6 +6,7 @@
pom
FeatureFramework BOM
+ ${project.groupId}featureframework-hud-api${project.version}
${project.groupId}featureframework-api${project.version}
${project.groupId}featureframework-theme-api${project.version}
${project.groupId}featureframework-toolkit${project.version}
diff --git a/featureframework-hud-api/pom.xml b/featureframework-hud-api/pom.xml
new file mode 100644
index 0000000..3efdab7
--- /dev/null
+++ b/featureframework-hud-api/pom.xml
@@ -0,0 +1,11 @@
+
+
+ 4.0.0
+ nl.hauntedmc.featureframeworkfeatureframework-parent${revision}
+ featureframework-hud-api
+ FeatureFramework HUD API
+
+ net.kyoriadventure-apiprovided
+ org.junit.jupiterjunit-jupitertest
+
+
diff --git a/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudCoordinator.java b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudCoordinator.java
new file mode 100644
index 0000000..5ab3893
--- /dev/null
+++ b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudCoordinator.java
@@ -0,0 +1,154 @@
+package nl.hauntedmc.featureframework.hud;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+import java.util.function.LongSupplier;
+
+/** Platform-independent lease engine. The host drives expiry/keepalive and enforces its thread. */
+public final class HudCoordinator implements HudService, AutoCloseable {
+ @FunctionalInterface
+ public interface Renderer { void render(UUID player, Channel channel, HudFrame frame); }
+ private record Key(UUID player, Channel channel) {}
+ private final Map> claims = new HashMap<>();
+ private final Map rendered = new HashMap<>();
+ private final Renderer renderer;
+ private final LongSupplier clock;
+ private final Runnable threadCheck;
+ private long sequence;
+ private boolean closed;
+
+ public HudCoordinator(Renderer renderer, LongSupplier clock, Runnable threadCheck) {
+ this.renderer = Objects.requireNonNull(renderer);
+ this.clock = Objects.requireNonNull(clock);
+ this.threadCheck = Objects.requireNonNull(threadCheck);
+ }
+
+ @Override public Lease claim(String owner, UUID player, Channel channel, int priority, Duration lifetime) {
+ check();
+ if (owner == null || owner.isBlank()) throw new IllegalArgumentException("Missing HUD owner");
+ Key key = new Key(Objects.requireNonNull(player), Objects.requireNonNull(channel));
+ Claim claim = new Claim(owner, key, priority, ++sequence, deadline(lifetime));
+ claims.computeIfAbsent(key, ignored -> new LinkedHashMap<>()).put(claim.id, claim);
+ try { render(key, false); }
+ catch (RuntimeException failure) {
+ claims.get(key).remove(claim.id);
+ try { render(key, false); }
+ catch (RuntimeException restoreFailure) { if (restoreFailure != failure) failure.addSuppressed(restoreFailure); }
+ throw failure;
+ }
+ return claim;
+ }
+
+ /** Expire leases every host tick; request action-bar keepalive approximately once a second. */
+ public void tick(boolean keepalive) {
+ check();
+ RuntimeException failure=null;
+ for (Key key : new ArrayList<>(claims.keySet())) {
+ claims.get(key).values().removeIf(claim -> claim.expires <= clock.getAsLong());
+ try { render(key, keepalive && key.channel == Channel.ACTION_BAR); }
+ catch(RuntimeException problem) { if(failure==null) failure=problem; else if(problem!=failure) failure.addSuppressed(problem); }
+ }
+ if(failure!=null) throw failure;
+ }
+
+ @Override public void releaseOwner(String owner) {
+ check();
+ Objects.requireNonNull(owner);
+ RuntimeException failure = null;
+ for (Key key : new ArrayList<>(claims.keySet())) {
+ claims.get(key).values().removeIf(claim -> (claim.owner.equals(owner) || claim.owner.startsWith(owner + ":")));
+ try { render(key, false); }
+ catch (RuntimeException problem) { if (failure == null) failure = problem; else if (problem != failure) failure.addSuppressed(problem); }
+ }
+ if (failure != null) throw failure;
+ }
+
+ @Override public void removePlayer(UUID player) {
+ check();
+ Objects.requireNonNull(player);
+ RuntimeException failure = null;
+ for (Key key : new ArrayList<>(claims.keySet())) if (key.player.equals(player)) {
+ claims.remove(key);
+ rendered.remove(key);
+ try { renderer.render(player, key.channel, null); }
+ catch (RuntimeException problem) { if (failure == null) failure = problem; else if (problem != failure) failure.addSuppressed(problem); }
+ }
+ if (failure != null) throw failure;
+ }
+
+ private void render(Key key, boolean force) {
+ Map entries = claims.get(key);
+ Claim winner = entries == null ? null : entries.values().stream()
+ .filter(claim -> claim.expires > clock.getAsLong())
+ .min(Comparator.comparingInt(claim -> claim.priority).reversed()
+ .thenComparingLong(claim -> claim.id)).orElse(null);
+ HudFrame frame = winner == null ? null : winner.frame;
+ if (force || !Objects.equals(frame, rendered.get(key))) {
+ renderer.render(key.player, key.channel, frame);
+ if (frame == null) rendered.remove(key); else rendered.put(key, frame);
+ }
+ if (entries != null && entries.isEmpty()) claims.remove(key);
+ }
+
+ private long deadline(Duration lifetime) {
+ if (lifetime == null || lifetime.isNegative() || lifetime.isZero())
+ throw new IllegalArgumentException("Positive HUD lease duration required");
+ return Math.addExact(clock.getAsLong(), lifetime.toNanos());
+ }
+ private void check() {
+ threadCheck.run();
+ if (closed) throw new IllegalStateException("HUD coordinator is closed");
+ }
+ @Override public void close() {
+ if (closed) return;
+ threadCheck.run();
+ RuntimeException failure=null;
+ for (Key key : new ArrayList<>(claims.keySet())) {
+ try { renderer.render(key.player, key.channel, null); }
+ catch(RuntimeException problem) { if(failure==null) failure=problem; else if(problem!=failure) failure.addSuppressed(problem); }
+ }
+ claims.clear(); rendered.clear(); closed = true;
+ if(failure!=null) throw failure;
+ }
+
+ private final class Claim implements Lease {
+ private final String owner;
+ private final Key key;
+ private final int priority;
+ private final long id;
+ private long expires;
+ private HudFrame frame;
+ private Claim(String owner, Key key, int priority, long id, long expires) {
+ this.owner = owner; this.key = key; this.priority = priority; this.id = id; this.expires = expires;
+ }
+ public boolean active() {
+ threadCheck.run();
+ return !closed && expires > clock.getAsLong()
+ && claims.getOrDefault(key, Map.of()).get(id) == this;
+ }
+ public void update(HudFrame next) {
+ check();
+ if (!active()) throw new IllegalStateException("HUD lease expired");
+ if (next != null && next.channel() != key.channel) throw new IllegalArgumentException("Wrong HUD channel");
+ frame = next;
+ render(key, false);
+ }
+ public void renew(Duration lifetime) {
+ check();
+ if (!active()) throw new IllegalStateException("HUD lease expired");
+ expires = deadline(lifetime);
+ }
+ public void close() {
+ threadCheck.run();
+ if (closed) return;
+ Map entries = claims.get(key);
+ if (entries != null && entries.remove(id, this)) render(key, false);
+ }
+ }
+}
diff --git a/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudFrame.java b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudFrame.java
new file mode 100644
index 0000000..f1ad739
--- /dev/null
+++ b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudFrame.java
@@ -0,0 +1,56 @@
+package nl.hauntedmc.featureframework.hud;
+
+import java.time.Duration;
+import java.util.List;
+import java.util.Objects;
+import net.kyori.adventure.bossbar.BossBar;
+import net.kyori.adventure.text.Component;
+
+/** Immutable content; no platform entities or mutable Adventure boss bars cross this boundary. */
+public sealed interface HudFrame {
+ HudService.Channel channel();
+
+ record Sidebar(Component title, List lines) implements HudFrame {
+ public Sidebar {
+ Objects.requireNonNull(title);
+ lines = List.copyOf(lines);
+ if (lines.size() > 15) throw new IllegalArgumentException("A sidebar has at most 15 lines");
+ }
+ public HudService.Channel channel() { return HudService.Channel.SIDEBAR; }
+ }
+ record ActionBar(Component text) implements HudFrame {
+ public ActionBar { Objects.requireNonNull(text); }
+ public HudService.Channel channel() { return HudService.Channel.ACTION_BAR; }
+ }
+ record Bar(Component title, float progress, BossBar.Color color, BossBar.Overlay overlay,
+ java.util.Set flags) {
+ public Bar(Component title,float progress,BossBar.Color color,BossBar.Overlay overlay) {
+ this(title,progress,color,overlay,java.util.Set.of());
+ }
+ public Bar {
+ Objects.requireNonNull(title);
+ flags=java.util.Set.copyOf(flags);
+ Objects.requireNonNull(color);
+ Objects.requireNonNull(overlay);
+ if (!Float.isFinite(progress)) throw new IllegalArgumentException("Non-finite progress");
+ progress = Math.clamp(progress, 0, 1);
+ }
+ }
+ record Bars(List bars) implements HudFrame {
+ public Bars {
+ bars = List.copyOf(bars);
+ if (bars.size() > 2) throw new IllegalArgumentException("At most two managed bars");
+ }
+ public HudService.Channel channel() { return HudService.Channel.BOSS_BAR; }
+ }
+ record Title(Component title, Component subtitle, Duration fadeIn, Duration stay,
+ Duration fadeOut) implements HudFrame {
+ public Title {
+ Objects.requireNonNull(title);
+ Objects.requireNonNull(subtitle);
+ for (Duration time : List.of(fadeIn, stay, fadeOut))
+ if (time.isNegative()) throw new IllegalArgumentException("Negative title duration");
+ }
+ public HudService.Channel channel() { return HudService.Channel.TITLE; }
+ }
+}
diff --git a/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudService.java b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudService.java
new file mode 100644
index 0000000..6d19aac
--- /dev/null
+++ b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/HudService.java
@@ -0,0 +1,26 @@
+package nl.hauntedmc.featureframework.hud;
+
+import java.time.Duration;
+import java.util.UUID;
+
+/** Owner-thread HUD arbitration. A null frame suppresses underlying content without drawing. */
+public interface HudService {
+ enum Channel { SIDEBAR, ACTION_BAR, BOSS_BAR, TITLE }
+ int AMBIENT = 0;
+ int SESSION = 100;
+ int CONTEXT = 200;
+ int CRITICAL = 300;
+
+ /** Owner is the plugin name, optionally followed by colon-separated feature scopes. */
+ Lease claim(String owner, UUID player, Channel channel, int priority, Duration lifetime);
+ /** Releases this owner and its colon-separated descendant feature scopes. */
+ void releaseOwner(String owner);
+ void removePlayer(UUID player);
+
+ interface Lease extends AutoCloseable {
+ void update(HudFrame frame);
+ void renew(Duration lifetime);
+ boolean active();
+ @Override void close();
+ }
+}
diff --git a/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/package-info.java b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/package-info.java
new file mode 100644
index 0000000..5942239
--- /dev/null
+++ b/featureframework-hud-api/src/main/java/nl/hauntedmc/featureframework/hud/package-info.java
@@ -0,0 +1,2 @@
+/** Immutable HUD contracts and owner-thread priority arbitration, independent of a platform host. */
+package nl.hauntedmc.featureframework.hud;
diff --git a/featureframework-hud-api/src/test/java/nl/hauntedmc/featureframework/hud/HudCoordinatorTest.java b/featureframework-hud-api/src/test/java/nl/hauntedmc/featureframework/hud/HudCoordinatorTest.java
new file mode 100644
index 0000000..b4e5c0b
--- /dev/null
+++ b/featureframework-hud-api/src/test/java/nl/hauntedmc/featureframework/hud/HudCoordinatorTest.java
@@ -0,0 +1,157 @@
+package nl.hauntedmc.featureframework.hud;
+
+import static org.junit.jupiter.api.Assertions.*;
+
+import java.time.Duration;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.atomic.AtomicLong;
+import net.kyori.adventure.text.Component;
+import org.junit.jupiter.api.Test;
+
+class HudCoordinatorTest {
+ private final UUID player = UUID.randomUUID();
+ private final AtomicLong clock = new AtomicLong();
+ private final List writes = new ArrayList<>();
+ private final HudCoordinator hud = new HudCoordinator((id, channel, frame) -> writes.add(frame), clock::get, () -> {});
+ private final Duration lifetime = Duration.ofSeconds(10);
+ private HudFrame.ActionBar text(String value) { return new HudFrame.ActionBar(Component.text(value)); }
+
+ @Test void departureRestoresLatestUnderlyingContent() {
+ var ambient = hud.claim("server", player, HudService.Channel.ACTION_BAR, 0, lifetime);
+ ambient.update(text("before"));
+ var dungeon = hud.claim("dungeon", player, HudService.Channel.ACTION_BAR, 100, lifetime);
+ dungeon.update(text("in run"));
+ ambient.update(text("updated while hidden"));
+ assertEquals(text("in run"), writes.getLast());
+ dungeon.close();
+ assertEquals(text("updated while hidden"), writes.getLast());
+ dungeon.close();
+ assertTrue(ambient.active());
+ }
+
+ @Test void emptyClaimSuppressesAndExpiryRevealsAmbient() {
+ var ambient = hud.claim("server", player, HudService.Channel.ACTION_BAR, 0, lifetime);
+ ambient.update(text("ambient"));
+ hud.claim("run", player, HudService.Channel.ACTION_BAR, 100, Duration.ofSeconds(2));
+ assertNull(writes.getLast());
+ clock.set(Duration.ofSeconds(3).toNanos());
+ hud.tick(false);
+ assertEquals(text("ambient"), writes.getLast());
+ }
+
+ @Test void priorityAndStableTiesAreIndependentForEachPlayer() {
+ var first = hud.claim("first", player, HudService.Channel.ACTION_BAR, 200, lifetime);
+ first.update(text("first"));
+ var second = hud.claim("second", player, HudService.Channel.ACTION_BAR, 200, lifetime);
+ second.update(text("second"));
+ assertEquals(text("first"), writes.getLast());
+ var critical = hud.claim("critical", player, HudService.Channel.ACTION_BAR, 300, lifetime);
+ critical.update(text("urgent"));
+ assertEquals(text("urgent"), writes.getLast());
+ hud.releaseOwner("critical");
+ assertEquals(text("first"), writes.getLast());
+ first.close();
+ assertEquals(text("second"), writes.getLast());
+ hud.removePlayer(UUID.randomUUID());
+ assertTrue(second.active());
+ }
+
+ @Test void staleHandlesCannotRenewAndUnchangedFramesAreDeduplicated() {
+ var lease = hud.claim("run", player, HudService.Channel.ACTION_BAR, 100, lifetime);
+ lease.update(text("same"));
+ int count = writes.size();
+ lease.update(text("same"));
+ hud.tick(false);
+ assertEquals(count, writes.size());
+ hud.tick(true);
+ assertEquals(count + 1, writes.size());
+ hud.releaseOwner("run");
+ assertThrows(IllegalStateException.class, () -> lease.renew(lifetime));
+ lease.close();
+ hud.close();
+ lease.close();
+ }
+
+ @Test void aHundredPlayersRestoreIndependentlyWithoutUnchangedSidebarWrites() {
+ var frames=new java.util.HashMap();
+ var counter=new java.util.concurrent.atomic.AtomicInteger();
+ var coordinator=new HudCoordinator((id,channel,frame) -> { frames.put(id,frame); counter.incrementAndGet(); },clock::get,() -> {});
+ var participants=new java.util.LinkedHashMap();
+ for(int i=0;i<100;i++) {
+ UUID id=UUID.randomUUID();
+ var ambient=coordinator.claim("server",id,HudService.Channel.SIDEBAR,0,lifetime);
+ ambient.update(new HudFrame.Sidebar(Component.text("Server"),List.of(Component.text("latest"))));
+ var run=coordinator.claim("run-"+(i/10),id,HudService.Channel.SIDEBAR,100,lifetime);
+ run.update(new HudFrame.Sidebar(Component.text("Dungeon"),List.of(Component.text("running"))));
+ participants.put(id,run);
+ }
+ int initial=counter.get();
+ for(int i=0;i<200;i++) coordinator.tick(false);
+ assertEquals(initial,counter.get(),"Unchanged HUDs must not write packets");
+ coordinator.releaseOwner("run-0");
+ assertEquals(initial+10,counter.get());
+ assertEquals(90,participants.values().stream().filter(HudService.Lease::active).count());
+ coordinator.close();
+ assertTrue(participants.values().stream().noneMatch(HudService.Lease::active));
+ }
+
+ @Test void oneBrokenRendererCannotPreventOtherPlayersOrFinalCleanup() {
+ UUID broken=UUID.randomUUID(),healthy=UUID.randomUUID();
+ var fail=new java.util.concurrent.atomic.AtomicBoolean();
+ var frames=new java.util.HashMap();
+ var coordinator=new HudCoordinator((id,channel,frame) -> {
+ if(id.equals(broken) && fail.get()) throw new IllegalStateException("disconnected renderer");
+ frames.put(id,frame);
+ },clock::get,() -> {});
+ var brokenLease=coordinator.claim("run",broken,HudService.Channel.ACTION_BAR,100,lifetime);
+ var healthyLease=coordinator.claim("run",healthy,HudService.Channel.ACTION_BAR,100,lifetime);
+ brokenLease.update(text("broken")); healthyLease.update(text("healthy"));
+ fail.set(true);
+ assertThrows(IllegalStateException.class,() -> coordinator.tick(true));
+ assertEquals(text("healthy"),frames.get(healthy));
+ assertThrows(IllegalStateException.class,coordinator::close);
+ assertFalse(brokenLease.active()); assertFalse(healthyLease.active());
+ assertNull(frames.get(healthy));
+ }
+ @Test void failedOwnerCleanupStillReleasesAllPlayersAndDescendantScopes() {
+ var fail = new java.util.concurrent.atomic.AtomicBoolean();
+ var coordinator = new HudCoordinator((id, channel, frame) -> {
+ if (fail.get()) throw new IllegalStateException("renderer failed");
+ }, clock::get, () -> {});
+ var first = coordinator.claim("run", player, HudService.Channel.ACTION_BAR, 100, lifetime);
+ var second = coordinator.claim("run:preview", UUID.randomUUID(), HudService.Channel.ACTION_BAR, 100, lifetime);
+ first.update(text("one")); second.update(text("two"));
+ fail.set(true);
+ assertThrows(IllegalStateException.class, () -> coordinator.releaseOwner("run"));
+ assertFalse(first.active()); assertFalse(second.active());
+ }
+
+ @Test void failedClaimDoesNotLeaveAnInvisibleLeaseSuppressingAmbientContent() {
+ var fail = new java.util.concurrent.atomic.AtomicBoolean();
+ var frames = new ArrayList();
+ var coordinator = new HudCoordinator((id, channel, frame) -> {
+ if (fail.get() && frame == null) throw new IllegalStateException("suppression failed");
+ frames.add(frame);
+ }, clock::get, () -> {});
+ var ambient = coordinator.claim("server", player, HudService.Channel.ACTION_BAR, 0, lifetime);
+ ambient.update(text("before"));
+ fail.set(true);
+ assertThrows(IllegalStateException.class, () -> coordinator.claim("run", player, HudService.Channel.ACTION_BAR, 100, lifetime));
+ ambient.update(text("after"));
+ assertEquals(text("after"), frames.getLast());
+ }
+
+ @Test void failedPlayerCleanupStillInvalidatesEveryChannel() {
+ var fail = new java.util.concurrent.atomic.AtomicBoolean();
+ var coordinator = new HudCoordinator((id, channel, frame) -> {
+ if (fail.get()) throw new IllegalStateException("renderer failed");
+ }, clock::get, () -> {});
+ var action = coordinator.claim("run", player, HudService.Channel.ACTION_BAR, 100, lifetime);
+ var title = coordinator.claim("run", player, HudService.Channel.TITLE, 100, lifetime);
+ fail.set(true);
+ assertThrows(IllegalStateException.class, () -> coordinator.removePlayer(player));
+ assertFalse(action.active()); assertFalse(title.active());
+ }
+}
diff --git a/featureframework-paper-toolkit/src/main/java/nl/hauntedmc/featureframework/paper/ui/hud/actionbar/impl/PaperActionBarService.java b/featureframework-paper-toolkit/src/main/java/nl/hauntedmc/featureframework/paper/ui/hud/actionbar/impl/PaperActionBarService.java
index 0cd0661..c2de53a 100644
--- a/featureframework-paper-toolkit/src/main/java/nl/hauntedmc/featureframework/paper/ui/hud/actionbar/impl/PaperActionBarService.java
+++ b/featureframework-paper-toolkit/src/main/java/nl/hauntedmc/featureframework/paper/ui/hud/actionbar/impl/PaperActionBarService.java
@@ -17,6 +17,9 @@
public final class PaperActionBarService implements ActionBarService {
private final Plugin plugin;
+ @FunctionalInterface
+ public interface Delivery { void send(Player player, Component component, int priority); }
+ private final Delivery delivery;
// Cycle state
private ActionBarCycle currentCycle = null;
@@ -41,7 +44,17 @@ public final class PaperActionBarService implements ActionBarService {
private final Map targetedOverrides = new HashMap<>();
public PaperActionBarService(@NotNull Plugin plugin) {
+ this(plugin, (java.util.function.BiConsumer) (player, component) -> player.sendActionBar(component));
+ }
+
+ /** Allows a platform host to route all ambient and timed frames through its HUD coordinator. */
+ public PaperActionBarService(Plugin plugin, java.util.function.BiConsumer delivery) {
+ this(plugin, (player, component, priority) -> delivery.accept(player, component));
+ }
+
+ public PaperActionBarService(Plugin plugin, Delivery delivery) {
this.plugin = plugin;
+ this.delivery = java.util.Objects.requireNonNull(delivery);
}
/* ========================= ActionBarService ========================= */
@@ -97,7 +110,7 @@ public void sendOnce(@NotNull Player player, @NotNull Component component) {
runSync(() -> {
clearTargetedOverride(player.getUniqueId());
if (player.isOnline()) {
- player.sendActionBar(component);
+ delivery.send(player, component, 300);
}
});
}
@@ -249,7 +262,7 @@ private void startTargetedOverride(Player player,
clearTargetedOverride(playerId);
if (seconds <= 0) {
if (player.isOnline()) {
- player.sendActionBar(component);
+ delivery.send(player, component, 300);
}
return;
}
@@ -265,7 +278,7 @@ private void startTargetedOverride(Player player,
clearTargetedOverride(playerId);
return;
}
- online.sendActionBar(component);
+ delivery.send(online, component, 300);
}, 0L, 20L);
int ending = Bukkit.getScheduler().scheduleSyncDelayedTask(plugin, () -> {
@@ -292,7 +305,7 @@ private void clearOwnedTargetedOverride(Player player, String owner) {
}
clearTargetedOverride(playerId);
if (player.isOnline()) {
- player.sendActionBar(Component.empty());
+ delivery.send(player, Component.empty(), 300);
}
}
@@ -328,14 +341,14 @@ private void cancelTask(int taskId) {
private void sendCycleActionBarAll(Component component) {
for (Player player : Bukkit.getOnlinePlayers()) {
if (!cycleSuppressedFor(player)) {
- player.sendActionBar(component);
+ delivery.send(player, component, 0);
}
}
}
private void sendActionBarAll(Component component) {
for (Player player : Bukkit.getOnlinePlayers()) {
- player.sendActionBar(component);
+ delivery.send(player, component, 300);
}
}
@@ -347,7 +360,7 @@ private void sendActionBarAllPerPlayer(@NotNull Function supp
}
Component component = supplier.apply(player);
if (component != null) {
- player.sendActionBar(component);
+ delivery.send(player, component, cycleFrame ? 0 : 300);
}
}
}
diff --git a/pom.xml b/pom.xml
index fe133b2..bdf9152 100644
--- a/pom.xml
+++ b/pom.xml
@@ -71,6 +71,7 @@
featureframework-mockito-testkit
featureframework-api
featureframework-theme-api
+ featureframework-hud-api
featureframework-toolkit
featureframework-processor
featureframework-core
@@ -89,8 +90,8 @@
3.5.2
1.19.2
- 2.2.4
- 2026-11-04T00:00:00Z
+ 2.2.5
+ 2026-11-12T00:00:00Z
diff --git a/tools/release/prepare-version.sh b/tools/release/prepare-version.sh
index 6854267..555f360 100755
--- a/tools/release/prepare-version.sh
+++ b/tools/release/prepare-version.sh
@@ -9,6 +9,7 @@ readonly MODULES=(
featureframework-mockito-testkit
featureframework-api
featureframework-theme-api
+ featureframework-hud-api
featureframework-toolkit
featureframework-processor
featureframework-core