Interface AudienceProvider
public interface AudienceProvider
Provides various
Audience instances.-
Method Summary
Modifier and TypeMethodDescriptiongetConnection(mindustry.net.NetConnection connection) Returns an audience from a rawNetConnection.Returns anAudienceinstance representing everything and everyone.Returns anAudienceinstance representing the player with the given uuid.getPlayer(mindustry.gen.Player player) Returns anAudienceinstance representing the player with the givenPlayer.Returns anAudienceinstance representing all players.Returns anAudienceinstance representing the server.getTeam(mindustry.game.Team team) Returns anAudienceinstance representing the team with the givenTeam.
-
Method Details
-
getEveryone
Audience getEveryone()Returns anAudienceinstance representing everything and everyone. Will dynamically update as players join and leave. -
getPlayer
Returns anAudienceinstance representing the player with the givenMUUID. Will return an empty audience if the player is not online.- Parameters:
muuid- the player'sMUUID- Returns:
- the player's audience or an empty audience
-
getPlayer
Returns anAudienceinstance representing the player with the given uuid.Keep in mind this method is not secure, especially if strict mode is disabled.
- Parameters:
uuid- the player uuid- Returns:
- the player's audience or an empty audience
-
getPlayer
Returns anAudienceinstance representing the player with the givenPlayer. UnlikegetPlayer(MUUID), this method will never return an empty audience.- Parameters:
player- the player- Returns:
- the player's audience
-
getConnection
Returns an audience from a rawNetConnection.
If called before thePlayerinstance is created, most of the player metadata will be missing. But will be partially populated afterEventType.ConnectPacketEventis fired.
Otherwise, it will be the same as callinggetPlayer(Player).- Parameters:
connection- the connection- Returns:
- the player's audience
-
getServer
Audience getServer()Returns anAudienceinstance representing the server. -
getPlayers
Audience getPlayers()Returns anAudienceinstance representing all players. Will dynamically update as players join and leave. -
getTeam
Returns anAudienceinstance representing the team with the givenTeam. Will dynamically update as players join and leave.- Parameters:
team- the team- Returns:
- the team's audience
-