Package net.kyori.adventure.platform
Interface AudienceProvider
-
- All Superinterfaces:
java.lang.AutoCloseable
public interface AudienceProvider extends java.lang.AutoCloseable
A provider for creatingAudience
s.- Since:
- 4.0.0
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
AudienceProvider.Builder<P extends AudienceProvider,B extends AudienceProvider.Builder<P,B>>
A builder forAudienceProvider
.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description @NotNull 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.@NotNull Audience
console()
Gets an audience for the server's console.@NotNull ComponentFlattener
flattener()
Return a component flattener that can use game data to resolve extra information about components.@NotNull Audience
permission(@NotNull java.lang.String permission)
Gets or creates an audience containing all viewers with the provided permission.default @NotNull Audience
permission(@NotNull net.kyori.adventure.key.Key permission)
Gets or creates an audience containing all viewers with the provided permission.@NotNull Audience
player(@NotNull java.util.UUID playerId)
Gets an audience for an individual player.@NotNull Audience
players()
Gets an audience for all online players.@NotNull Audience
server(@NotNull java.lang.String serverName)
Gets an audience for online players on a server, including the server's console.@NotNull Audience
world(@NotNull net.kyori.adventure.key.Key world)
Gets an audience for online players in a world, including the server's console.
-
-
-
Method Detail
-
all
@NotNull @NotNull 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
- Since:
- 4.0.0
-
console
@NotNull @NotNull Audience console()
Gets an audience for the server's console.- Returns:
- the console audience
- Since:
- 4.0.0
-
players
@NotNull @NotNull Audience players()
Gets an audience for all online players.The audience is dynamically updated as players join and leave.
- Returns:
- the players' audience
- Since:
- 4.0.0
-
player
@NotNull @NotNull Audience player(@NotNull @NotNull 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
- Since:
- 4.0.0
-
permission
@NotNull default @NotNull Audience permission(@NotNull @NotNull 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
- Since:
- 4.0.0
-
permission
@NotNull @NotNull Audience permission(@NotNull @NotNull 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
- Since:
- 4.0.0
-
world
@NotNull @NotNull Audience world(@NotNull @NotNull 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
- Since:
- 4.0.0
-
server
@NotNull @NotNull Audience server(@NotNull @NotNull 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
- Since:
- 4.0.0
-
flattener
@NotNull @NotNull ComponentFlattener flattener()
Return a component flattener that can use game data to resolve extra information about components.This can be used for displaying components, or with serializers including the plain and legacy serializers.
- Returns:
- the flattener
- Since:
- 4.0.0
-
close
void close()
Closes the provider and forces audiences to be empty.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Since:
- 4.0.0
-
-