Skip to main content
Version: 0.2.0

Class PlayerApi

Namespace: ReadyM.Relay.Server.Sdk.Players
Assembly: ReadyM.Relay.Server.Sdk.dll

Provides access to player events and actions on the server.

public class PlayerApi

Inheritance​

object ← PlayerApi

Inherited Members​

object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Methods​

GetReadyMId(PlayerId)​

Get the id ReadyM assigned to this player's account, or null if this server has not seen them since it started. Global to the platform: the same player carries the same id every time, it survives reconnects and server restarts. PlayerId does none of that, so key anything you persist on this instead.

public Guid? GetReadyMId(PlayerId player)

Parameters​

player PlayerId

Returns​

Guid?

Kick(PlayerId)​

Kicks the player from the server. This is a hard disconnect, and the player will not be able to reconnect until they restart the game.

public void Kick(PlayerId player)

Parameters​

player PlayerId

The player to kick.

OnPlayerConnected​

Fired once the player has finished the handshake and their ECS entity exists.

[Obsolete("This API is being deprecated in favor of the more general ServerEventsApi.")]
public event Action<PlayerConnectedEvent>? OnPlayerConnected

Event Type​

Action<PlayerConnectedEvent>?

OnPlayerDisconnected​

Fired when the player leaves, whichever way they left.

[Obsolete("This API is being deprecated in favor of the more general ServerEventsApi.")]
public event Action<PlayerDisconnectedEvent>? OnPlayerDisconnected

Event Type​

Action<PlayerDisconnectedEvent>?

  • Methods
    • GetReadyMId(PlayerId)
    • Kick(PlayerId)
    • OnPlayerConnected
    • OnPlayerDisconnected