Per-player display
The minigame lobby has a "Ready" button. After Alice clicks it, her button says "Ready", while Bob's still says "Click to ready".
You could build a new button for every menu open and capture that viewer, but then the button cannot be shared between windows. A shared button has to know, at render time, who is looking.
What binding by viewer doesâ
dependsOn(signal, keyOf) takes a KeyedSignal and a function that picks a key. The function receives the render context of the display position and returns the partition key to bind there.
For per-player partitions, return context.player().getUniqueId() and every viewer binds their own partition. When Alice's partition changes, only the button Alice sees refreshes.
A shared ready buttonâ
ready keeps each player's ready state by UUID; see Player partitions. In the demo, the top row is what Alice sees and the bottom row is what Bob sees. Both are the same readyButton.
Every player starts not ready, and partitions are cleaned up when they quit.
MutableKeyedSignal<UUID, Boolean> ready = KeyedSignal.of(playerId -> false);
Signals.evictOnQuit(ready);
// create the button once and put it in every player's lobby menu
Item readyButton = Item.builder()
.dependsOn(ready, context -> context.player().getUniqueId())
.setItemProvider(context -> {
boolean isReady = ready.get(context.player().getUniqueId());
return isReady
? named(Material.LIME_DYE, "Ready")
: named(Material.GRAY_DYE, "Click to ready");
})
.addClickHandler(click -> {
ready.update(click.player().getUniqueId(), value -> !value);
})
.build();
Pane pane = Pane.builder("####R####")
.addIngredient('R', readyButton)
.build();
Window.builder(pane).setTitle("Minigame lobby").open(viewer);


ready[alice] | false | |
|---|---|---|
ready[bob] | false |
Binding by a business keyâ
The key does not have to come from the player. An arena entrance button shows the desert arena's player count, and every viewer binds the same partition, "desert".
MutableKeyedSignal<String, Integer> arenaPlayers = KeyedSignal.of(arena -> 0);
Item desertButton = Item.builder()
.dependsOn(arenaPlayers, context -> "desert") // every viewer binds the desert partition
.setItemProvider(context -> {
String name = "Desert arena: " + arenaPlayers.get("desert") + " players";
return named(Material.SAND, name);
})
.build();
After game code calls arenaPlayers.update("desert", count -> count + 1), everyone looking at this button sees the new count; forest arena changes leave it alone.
Caveatsâ
In shared Providers and click handlers, use context.player() for the viewer and click.player() for the clicker. Capturing a viewer from menu creation makes everyone see that one player's data.
The key function runs once when the item is mounted in a slot. If a player switches teams mid-session, the function would now return another key, but slots already mounted do not rebind. To follow a selection, use switching.
private static ItemStack named(Material material, String name) {
ItemStack stack = new ItemStack(material);
stack.setData(DataComponentTypes.CUSTOM_NAME,
Component.text(name).decoration(TextDecoration.ITALIC, false)
);
return stack;
}
It uses Paper's DataComponentTypes with Adventure's Component and TextDecoration, matching Item rendering.