Interface AudienceProvider

  • All Superinterfaces:
    java.lang.AutoCloseable
    All Known Implementing Classes:
    FacetAudienceProvider

    public interface AudienceProvider
    extends java.lang.AutoCloseable
    A provider for creating Audiences.
    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      @NonNull net.kyori.adventure.audience.Audience all()
      Gets an audience for all online players, including the server's console.
      void close()
      Closes the provider and forces audiences to be empty.
      @NonNull net.kyori.adventure.audience.Audience console()
      Gets an audience for the server's console.
      @NonNull net.kyori.adventure.audience.Audience permission​(@NonNull java.lang.String permission)
      Gets or creates an audience containing all viewers with the provided permission.
      default @NonNull net.kyori.adventure.audience.Audience permission​(@NonNull net.kyori.adventure.key.Key permission)
      Gets or creates an audience containing all viewers with the provided permission.
      @NonNull net.kyori.adventure.audience.Audience player​(@NonNull java.util.UUID playerId)
      Gets an audience for an individual player.
      @NonNull net.kyori.adventure.audience.Audience players()
      Gets an audience for all online players.
      @NonNull net.kyori.adventure.audience.Audience server​(@NonNull java.lang.String serverName)
      Gets an audience for online players on a server, including the server's console.
      @NonNull net.kyori.adventure.audience.Audience world​(@NonNull net.kyori.adventure.key.Key world)
      Gets an audience for online players in a world, including the server's console.
    • Method Detail

      • all

        @NonNull net.kyori.adventure.audience.Audience all()
        Gets an audience for all online players, including the server's console.

        The audience is dynamically updated as players join and leave.

        Returns:
        the players' and console audience
      • console

        @NonNull net.kyori.adventure.audience.Audience console()
        Gets an audience for the server's console.
        Returns:
        the console audience
      • players

        @NonNull net.kyori.adventure.audience.Audience players()
        Gets an audience for all online players.

        The audience is dynamically updated as players join and leave.

        Returns:
        the players' audience
      • player

        @NonNull net.kyori.adventure.audience.Audience player​(@NonNull java.util.UUID playerId)
        Gets an audience for an individual player.

        If the player is not online, messages are silently dropped.

        Parameters:
        playerId - a player uuid
        Returns:
        a player audience
      • permission

        default @NonNull net.kyori.adventure.audience.Audience permission​(@NonNull net.kyori.adventure.key.Key permission)
        Gets or creates an audience containing all viewers with the provided permission.

        The audience is dynamically updated as permissions change.

        Parameters:
        permission - the permission to filter sending to
        Returns:
        a permissible audience
      • permission

        @NonNull net.kyori.adventure.audience.Audience permission​(@NonNull java.lang.String permission)
        Gets or creates an audience containing all viewers with the provided permission.

        The audience is dynamically updated as permissions change.

        Parameters:
        permission - the permission to filter sending to
        Returns:
        a permissible audience
      • world

        @NonNull net.kyori.adventure.audience.Audience world​(@NonNull net.kyori.adventure.key.Key world)
        Gets an audience for online players in a world, including the server's console.

        The audience is dynamically updated as players join and leave.

        World identifiers were introduced in Minecraft 1.16. On older game instances, worlds will be assigned the Key minecraft:<world name>

        Parameters:
        world - identifier for a world
        Returns:
        the world's audience
      • server

        @NonNull net.kyori.adventure.audience.Audience server​(@NonNull java.lang.String serverName)
        Gets an audience for online players on a server, including the server's console.

        If the platform is not a proxy, the audience defaults to everyone.

        Parameters:
        serverName - a server name
        Returns:
        a server's audience
      • close

        void close()
        Closes the provider and forces audiences to be empty.
        Specified by:
        close in interface java.lang.AutoCloseable