Class NullPlayerService
- Namespace
- Uncreated.Warfare.Players.Management
- Assembly
- Uncreated.Warfare.dll
Implementation of IPlayerService with an empty player list. For use in external applications.
public class NullPlayerService : IPlayerService
- Inheritance
-
NullPlayerService
- Implements
- Inherited Members
- Extension Methods
Constructors
NullPlayerService(IServiceProvider)
public NullPlayerService(IServiceProvider serviceProvider)
Parameters
serviceProviderIServiceProvider
Properties
OnlinePlayers
List of all online players. Not to be accessed from any thread other than the game thread.
public ReadOnlyTrackingList<WarfarePlayer> OnlinePlayers { get; }
Property Value
Exceptions
Methods
CreateOfflinePlayerAsync(CSteamID, CancellationToken)
Create an IPlayer instance from a possibly offline player and fetch their usernames for display.
public ValueTask<IPlayer> CreateOfflinePlayerAsync(CSteamID steam64, CancellationToken token = default)
Parameters
steam64CSteamIDtokenCancellationToken
Returns
GetOnlinePlayer(ulong)
Get a player who's known to be online. Not to be invoked from any thread other than the game thread.
public WarfarePlayer GetOnlinePlayer(ulong steam64)
Parameters
steam64ulong
Returns
Exceptions
GetOnlinePlayerOrNull(ulong)
Get a player if they're online, otherwise null. Not to be invoked from any thread other than the game thread.
public WarfarePlayer? GetOnlinePlayerOrNull(ulong steam64)
Parameters
steam64ulong
Returns
Exceptions
GetOnlinePlayerOrNullThreadSafe(ulong)
Get a player if they're online, otherwise null.
public WarfarePlayer? GetOnlinePlayerOrNullThreadSafe(ulong steam64)
Parameters
steam64ulong
Returns
GetOnlinePlayerThreadSafe(ulong)
Get a player who's known to be online.
public WarfarePlayer GetOnlinePlayerThreadSafe(ulong steam64)
Parameters
steam64ulong
Returns
Exceptions
GetThreadsafePlayerList()
Gets a copy of the player list for working on non-game threads.
public IReadOnlyList<WarfarePlayer> GetThreadsafePlayerList()
Returns
IsPlayerOnline(ulong)
Quickly check if a player is online.
public bool IsPlayerOnline(ulong steam64)
Parameters
steam64ulong
Returns
Exceptions
IsPlayerOnlineThreadSafe(ulong)
Quickly check if a player is online.
public bool IsPlayerOnlineThreadSafe(ulong steam64)
Parameters
steam64ulong
Returns
SubscribeToPlayerEvent<TDelegate>(Action<WarfarePlayer, TDelegate>, TDelegate)
Subscribes to an instance event on a player.
public void SubscribeToPlayerEvent<TDelegate>(Action<WarfarePlayer, TDelegate> subscribe, TDelegate value) where TDelegate : MulticastDelegate
Parameters
subscribeAction<WarfarePlayer, TDelegate>valueTDelegate
Type Parameters
TDelegate
UnsubscribeFromPlayerEvent<TDelegate>(Action<WarfarePlayer, TDelegate>, TDelegate)
Unsubscribes from an instance event on a player.
public void UnsubscribeFromPlayerEvent<TDelegate>(Action<WarfarePlayer, TDelegate> unsubscribe, TDelegate value) where TDelegate : MulticastDelegate
Parameters
unsubscribeAction<WarfarePlayer, TDelegate>valueTDelegate
Type Parameters
TDelegate