Table of Contents

Class Player

Namespace
Shard.Server.Players
Assembly
Shard.Server.Players.dll

Represents one accepted authenticated player login.

public sealed class Player : ICommandSender, IPermissionHolder
Inheritance
Player
Implements
Inherited Members

Properties

Id

Gets the authenticated player identifier.

public Guid Id { get; }

Property Value

Guid

Language

Gets the client's selected BCP-47 language.

public string Language { get; }

Property Value

string

Name

Gets the normalized player name accepted during setup.

public string Name { get; }

Property Value

string

Skin

Gets the validated Character Creator selection supplied by authentication.

public PlayerSkinSelection? Skin { get; }

Property Value

PlayerSkinSelection

Methods

HasPermission(string, bool)

Checks one permission for the authenticated player identifier.

public bool HasPermission(string permission, bool defaultValue)

Parameters

permission string
defaultValue bool

Returns

bool

The configured result or defaultValue when no service owns it.

SendMessage(FormattedMessage)

Sends a localized protocol message to this Player's active connection.

public void SendMessage(FormattedMessage message)

Parameters

message FormattedMessage

SendMessage(string)

Best-effort sends one chat message to this Player's active connection.

public void SendMessage(string message)

Parameters

message string

Remarks

A concurrent disconnect may reject or drop the message without failing the caller.

TryDisconnectForProtocolViolation()

Attempts to disconnect this login after invalid protocol input.

public bool TryDisconnectForProtocolViolation()

Returns

bool

TrySend(IToClientPacket)

Attempts to send one targeted packet through this login's active connection.

public bool TrySend(IToClientPacket packet)

Parameters

packet IToClientPacket

Returns

bool

true when the connection accepted the packet.

Remarks

The packet is sent only through this Player's connection. When the connection accepts it, the caller must not mutate the packet afterward.