Class AudienceRegistry

java.lang.Object
net.minestom.server.adventure.audience.AudienceRegistry

public class AudienceRegistry extends Object
Holder of custom audiences.
  • Constructor Summary

    Constructors
    Constructor
    Description
    AudienceRegistry(@NotNull Map<net.kyori.adventure.key.Key,Collection<Audience>> backingMap, @NotNull Supplier<Collection<Audience>> backingCollection)
    Creates a new audience registrar with a given backing map.
  • Method Summary

    Modifier and Type
    Method
    Description
    @NotNull Iterable<? extends Audience>
    all()
    Gets every audience in the registry.
    boolean
    Checks if this registry is empty.
    @NotNull Iterable<? extends Audience>
    of(@NotNull Predicate<Audience> filter)
    Gets every audience member in the registry who matches a given predicate.
    @NotNull Iterable<? extends Audience>
    of(@NotNull net.kyori.adventure.key.Key key)
    Gets every audience in the registry under a specific key.
    @NotNull Iterable<? extends Audience>
    of(@NotNull net.kyori.adventure.key.Keyed keyed)
    Gets every audience in the registry under a specific key.
    void
    register(@NotNull net.kyori.adventure.key.Keyed keyed, @NotNull Collection<Audience> audiences)
    Adds some audiences to the registry.
    void
    register(@NotNull net.kyori.adventure.key.Keyed keyed, @NotNull Audience... audiences)
    Adds some audiences to the registry.
    void
    register(@NotNull net.kyori.adventure.key.Key key, @NotNull Collection<Audience> audiences)
    Adds some audiences to the registry.
    void
    register(@NotNull net.kyori.adventure.key.Key key, @NotNull Audience... audiences)
    Adds some audiences to the registry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • AudienceRegistry

      public AudienceRegistry(@NotNull @NotNull Map<net.kyori.adventure.key.Key,Collection<Audience>> backingMap, @NotNull @NotNull Supplier<Collection<Audience>> backingCollection)
      Creates a new audience registrar with a given backing map.
      Parameters:
      backingMap - the backing map
      backingCollection - a provider for the backing collection
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Checks if this registry is empty.
      Returns:
      true if it is, false otherwise
    • register

      public void register(@NotNull @NotNull net.kyori.adventure.key.Keyed keyed, @NotNull @NotNull Audience... audiences)
      Adds some audiences to the registry.
      Parameters:
      keyed - the provider of the key
      audiences - the audiences
    • register

      public void register(@NotNull @NotNull net.kyori.adventure.key.Keyed keyed, @NotNull @NotNull Collection<Audience> audiences)
      Adds some audiences to the registry.
      Parameters:
      keyed - the provider of the key
      audiences - the audiences
    • register

      public void register(@NotNull @NotNull net.kyori.adventure.key.Key key, @NotNull @NotNull Audience... audiences)
      Adds some audiences to the registry.
      Parameters:
      key - the key to store the audiences under
      audiences - the audiences
    • register

      public void register(@NotNull @NotNull net.kyori.adventure.key.Key key, @NotNull @NotNull Collection<Audience> audiences)
      Adds some audiences to the registry.
      Parameters:
      key - the key to store the audiences under
      audiences - the audiences
    • all

      @NotNull public @NotNull Iterable<? extends Audience> all()
      Gets every audience in the registry.
      Returns:
      an iterable containing every audience member
    • of

      @NotNull public @NotNull Iterable<? extends Audience> of(@NotNull @NotNull net.kyori.adventure.key.Keyed keyed)
      Gets every audience in the registry under a specific key.
      Parameters:
      keyed - the key provider
      Returns:
      an iterable containing the audience members
    • of

      @NotNull public @NotNull Iterable<? extends Audience> of(@NotNull @NotNull net.kyori.adventure.key.Key key)
      Gets every audience in the registry under a specific key.
      Parameters:
      key - the key
      Returns:
      an iterable containing the audience members
    • of

      @NotNull public @NotNull Iterable<? extends Audience> of(@NotNull @NotNull Predicate<Audience> filter)
      Gets every audience member in the registry who matches a given predicate.
      Parameters:
      filter - the predicate
      Returns:
      the matching audience members