runebook · rune
runebook · rune
manifest: sha256:79fbbe32a307f312deb0fe5feb6d35e406f8a669fdcc7ede56ac628cc9f4f537
rune add @rune/preferences@0.1.5Let players control announcements, action bars, and sounds from Runes that read their preferences. Values default to on and persist by player UUID.
rune add @rune/preferences
Restart Paper. In game, /preferences lists your settings. Append
announcements, actionbars, or sounds to toggle a setting.
@rune/announcements
honors the announcement setting for both manual and scheduled messages.
Read the version 1 preferences service. Check the preference before
sending messages, playing sounds, or updating the action bar.
type Setting = "announcements" | "actionbars" | "sounds";
type Preferences = {
get(playerId: string, key: Setting): boolean;
set(playerId: string, key: Setting, value: boolean): Promise<void>;
};
function showNotice(player: Player, text: string) {
const prefs = rune.services.get<Preferences>("preferences", 1);
if (prefs?.get(String(player.getUniqueId()), "actionbars") !== false) {
rune.adventure.actionBar(player, text);
}
}
set waits for the storage write. The preferences.changed event carries
{ playerId, key, value }, including updates observed from shared storage.
Use the server environment to set RUNE_PREFERENCES_STORAGE to local,
reuse:shared, or connect. For connect, install the database adapter and set
RUNE_PREFERENCES_DB_URL. The default keeps existing local data and otherwise prefers
an open connection when available. Storage setup
With @rune/dashboard running on Rune 0.5.3 or newer, this Rune adds
its own navigation and pages. See player opt-out counts for each preference.
Open Player preferences in Rune Dashboard to find a player and manage their announcements, action bars, and sounds. This page requires Rune 0.5.4 or newer and @rune/dashboard 0.1.2 or newer.