Interface IPlayerService
Namespace: Void.Proxy.Api.Players
Assembly: Void.Proxy.Api.dll
Provides operations for managing
public interface IPlayerServiceExtension Methods
PlayerServiceExtensions.TryGetByName(IPlayerService, string, out IPlayer?)
Properties
All
Gets a collection containing all active players.
IEnumerable<IPlayer> All { get; }Property Value
Methods
AcceptPlayerAsync(TcpClient, CancellationToken)
Accepts a new connection and creates a player instance from the provided
ValueTask AcceptPlayerAsync(TcpClient client, CancellationToken cancellationToken = default)Parameters
client TcpClient
The client representing the player connection.
cancellationToken CancellationToken
Token used to cancel the operation.
Returns
ForEach(Action<IPlayer>)
Executes the specified action for each player.
void ForEach(Action<IPlayer> action)Parameters
The action to perform for each player.
ForEachAsync(Func<IPlayer, CancellationToken, ValueTask>, CancellationToken)
Executes the specified asynchronous action for each player.
ValueTask ForEachAsync(Func<IPlayer, CancellationToken, ValueTask> action, CancellationToken cancellationToken = default)Parameters
action Func<IPlayer, CancellationToken, ValueTask>
The asynchronous action to execute for each player.
cancellationToken CancellationToken
Token used to cancel the operation.
Returns
KickPlayerAsync(IPlayer, string?, CancellationToken)
Kicks a player with an optional message.
ValueTask KickPlayerAsync(IPlayer player, string? text = null, CancellationToken cancellationToken = default)Parameters
player IPlayer
The player to kick.
text string?
The optional kick message.
cancellationToken CancellationToken
Token used to cancel the operation.
Returns
KickPlayerAsync(IPlayer, PlayerKickEvent, CancellationToken)
Kicks a player using a
ValueTask KickPlayerAsync(IPlayer player, PlayerKickEvent playerKickEvent, CancellationToken cancellationToken = default)Parameters
player IPlayer
The player to kick.
playerKickEvent PlayerKickEvent
The event describing the kick.
cancellationToken CancellationToken
Token used to cancel the operation.
Returns
UpgradeAsync(IPlayer, IPlayer, CancellationToken)
Upgrades the specified player to upgradedPlayer.
ValueTask UpgradeAsync(IPlayer player, IPlayer upgradedPlayer, CancellationToken cancellationToken)Parameters
player IPlayer
The current player instance.
upgradedPlayer IPlayer
The upgraded player instance.
cancellationToken CancellationToken
Token used to cancel the operation.