Skip to content

Creation of KeyedBossBar instance does not match when retrieving #13934

@Absolutionism

Description

@Absolutionism

Expected behavior

The KeyedBossBar created via Bukkit#createBossBar(NamespacedKey) to be the same instance via Bukkit#getBossBar(NamespacedKey)

Observed/Actual behavior

In CraftServer#createBossBar(NamespacedKey), a new CustomBossEvent is created as well as a new CraftKeyedBossBar. However, the CraftKeyedBossBar is not stored on the newly created CustomBossEvent

So when using CraftServer#getBossBar(NamespacedKey) it grabs the CustomBossEvent, then calls #getBukkitEntity provided in a patch.
This patch method checks to see if a boss bar exists on the CustomBossEvent, if it does returns it, if it does not creates a new one then sets the boss bar field to this new instance.

Steps/models to reproduce

NamespacedKey key = new NamespacedKey("test");
KeyedBossBar bar1 = Bukkit.createBossBar(key, "title", BarColor.RED, BarStyle.SOLID);
KeyedBossBar bar2 = Bukkit.getBossBar(key);
if (bar1 == bar2) {
    // Wont ever be the case
} else {
   // Will always be the case
}

Plugin and Datapack List

[00:59:26 INFO]: ? Server Plugins (1):
[00:59:26 INFO]: Bukkit Plugins:
[00:59:26 INFO]:  - Skript
[00:59:39 INFO]: There are 3 data pack(s) enabled: [vanilla (built-in)], [file/bukkit (world)], [paper (built-in)]
[00:59:39 INFO]: There are no more data packs available

Paper version

[00:59:05 INFO]: Checking version, please wait...
[00:59:05 INFO]: This server is running Paper version 26.1.2-69-main@76d2ac7 (2026-06-03T17:32:02Z) (Implementing API version 26.1.2.build.69-stable)
You are running the latest version

Other

CraftServer#createBossBar(NamespacedKey)
CraftKeyedBossBar
CraftBossBar

CraftServer#getBossBar(NamespacedKey)
CustomBossEvent.patch

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions