Bossbar
com.jsmacrosce.jsmacros.client.api.event.impl.world.EventBossbar
Since1.2.7Not cancellable
Reports each boss-bar packet action after the client handles it. type identifies the action; bossBar is the full bar state when available.
js
JsMacros.on("Bossbar", JavaWrapper.methodToJava(function (event) {
if (event.bossBar === null) {
Chat.log(`Bossbar ${event.uuid} (${event.type}) is not on screen`);
return;
}
const bar = event.bossBar;
Chat.log(`${event.type} ${bar.getName().getString()} ${(bar.getPercent() * 100).toFixed(1)}% (${bar.getColor()})`);
}))Constructors
new EventBossbar
new EventBossbar(String type, UUID uuid, LerpingBossEvent bossBar)#Initializes this event from the supplied action, bar identifier, and optional raw bar. A non-null bar is wrapped in a BossBarHelper; a null bar leaves bossBar null. The supplied action is stored unchanged and is not validated against the bar or identifier. A null identifier throws
NullPointerException while converting it to a string.Parameters:
type: supplied action label; arbitrary values, includingnull, are stored unchangeduuid: identifier for the bar; must be non-nullbossBar: raw bar to wrap, ornullwhen no bar is available
Fields
bossBar
The full boss bar state, or
null if the overlay has no bar for this UUID. A 'REMOVE' event always has null; other update types may also have null. When non-null, it exposes the bar's getName(), getPercent(), getColor() and getStyle().type
uuid
Methods
toString
Formats a diagnostic string containing the event name and the current helper's string, or the stored UUID string when no helper is present. The fallback is unquoted and is not a standalone UUID field or a JSON serialization.
Returns: event name followed by
:{"bossBar": %s}, with %s replaced by the helper string or UUID string