KyoriPowered / adventure

A user-interface library, formerly known as text, for Minecraft: Java Edition
https://docs.advntr.dev/
MIT License
711 stars 107 forks source link

Give boss bars a usable identity #445

Open kezz opened 3 years ago

kezz commented 3 years ago

At the moment, platform implementations have to rely on hacky maps and wrapper objects to properly use and manage boss bars which is horrible and not fun to use. Additionally, it makes it incredibly hard for plugins to share boss bars around.

It would be nice to make some of the following changes to boss bars:

kashike commented 3 years ago

Give them an identity (most likely a Key to mimic Minecraft).

Not all bossbars in Minecraft have a Key-based identity. All bossbars do have a UUID, though.

Add a method to check if an Audience is viewing a boss bar (this would always default to false on ForwardingAudience).

I am not sure about this - I don't think I like the idea of such a method on Audience.

kezz commented 3 years ago

Not all bossbars in Minecraft have a Key-based identity. All bossbars do have a UUID, though.

Yes, but we're not providing a way to obtain boss bars not created by Adventure. Therefore we should be preferring to use an identity that is better for the user and dev experience. If necessary, a key could be created from a UUID, although as I don't think we should provide methods to obtain non-Adventure boss bars as Adventure boss bars, this isn't really necessary anyway.

I am not sure about this - I don't think I like the idea of such a method on Audience.

Why?