From 0117adf4a418ae4f6d26a24c3459bd19a8694633 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 18 Sep 2022 11:38:47 -0400 Subject: [PATCH 1/2] Add BossBar methods to FacetAudience --- .../kyori/adventure/platform/facet/FacetAudience.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java b/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java index dd63dac2..2fc38173 100644 --- a/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java +++ b/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java @@ -406,6 +406,16 @@ public void hideBossBar(final @NotNull BossBar bar) { } } + /** + * Check if this audience has been shown this BossBar + * @param bar The BossBar instance + * @return A boolean value + * @since 4.1.3 + */ + public boolean hasBossBar(final @NotNull BossBar bar) { + return this.bossBars != null && this.bossBars.containsKey(bar); + } + @Override public void sendPlayerListHeader(final @NotNull Component header) { if (this.tabList != null) { From 810a9f3529abfc11e461945a64cf0ae0fce74e78 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Sun, 18 Sep 2022 11:39:50 -0400 Subject: [PATCH 2/2] Add BossBar methods to FacetAudience (2) --- .../adventure/platform/facet/FacetAudience.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java b/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java index 2fc38173..8166e3f1 100644 --- a/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java +++ b/platform-facet/src/main/java/net/kyori/adventure/platform/facet/FacetAudience.java @@ -47,6 +47,7 @@ import org.jetbrains.annotations.ApiStatus; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.UnmodifiableView; import static java.util.Objects.requireNonNull; @@ -408,14 +409,21 @@ public void hideBossBar(final @NotNull BossBar bar) { /** * Check if this audience has been shown this BossBar - * @param bar The BossBar instance - * @return A boolean value * @since 4.1.3 */ public boolean hasBossBar(final @NotNull BossBar bar) { return this.bossBars != null && this.bossBars.containsKey(bar); } + /** + * Returns a set containing all BossBars this Audience has been shown + * @since 4.1.3 + */ + public @NotNull @UnmodifiableView Set getBossBars() { + if (this.bossBars == null) return Collections.emptySet(); + return Collections.unmodifiableSet(this.bossBars.keySet()); + } + @Override public void sendPlayerListHeader(final @NotNull Component header) { if (this.tabList != null) {