Skip to content

Replace BossBarViewer with Audience or use it more. #1349

@TurboJax

Description

@TurboJax

Currently there is an interface called "BossBarViewer", and it has two uses:

  1. It is used in net.kyori.adventure.bossbar.BossBar#viewers which returns an Iterable<? extends BossBarViewer>.
  2. It defines an activeBossBars function that returns an Iterable<? extends BossBar>.

Given how this interface is not used in the BossBar#addViewer or BossBar#removeViewer, I think it'd be a good idea to either remove the BossBarViewer interface or spread out its use.

To remove the interface, the activeBossBars function could be moved to the Audience interface, which would not be out of line due to Audience already having the showBossBar and hideBossBar functions. Then, the BossBar#viewers function would simply return Iterable<? extends Audience>.

To expand it's use, I think it would be a good idea to move the Audience#showBossBar and Audience#hideBossBar functions to BossBarViewer. The BossBar#addViewer and BossBar#removeViewer functions would also be modified to take a BossBarViewer object as the parameter.

As for the effects these changes will have on the implementations, adventure-platforms doesn't seem to support bossbars yet anyways, and I'd be willing to help with working on a solution for paper, but I doubt I'll be much help considering I don't know much about the codebase.

I'll work on both these solutions in time on a fork, but I figured I'd make this issue to pose the idea.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions