Class MinecraftPlayer
Namespace: Void.Minecraft.Players
Assembly: Void.Minecraft.dll
Represents a connected Java Edition Minecraft player.
public class MinecraftPlayer : IPlayer, IEquatable<IPlayer>, ICommandSource, IAsyncDisposable, IDisposableInheritance
Implements
IPlayer, IEquatable<IPlayer>, ICommandSource, IAsyncDisposable, IDisposable
Inherited Members
object.Equals(object?), object.Equals(object?, object?), object.GetHashCode(), object.GetType(), object.MemberwiseClone(), object.ReferenceEquals(object?, object?), object.ToString()
Constructors
MinecraftPlayer(TcpClient, IPlayerContext, string, DateTimeOffset, ProtocolVersion)
Represents a connected Java Edition Minecraft player.
public MinecraftPlayer(TcpClient client, IPlayerContext context, string remoteEndPoint, DateTimeOffset connectedAt, ProtocolVersion protocolVersion)Parameters
client TcpClient
The accepted TCP client owned by the player context.
context IPlayerContext
The player-scoped services and network context.
remoteEndPoint string
The preformatted remote endpoint used before a profile name is known.
connectedAt DateTimeOffset
The timestamp at which the connection was accepted.
protocolVersion ProtocolVersion
The Java Edition protocol version detected for the connection.
Properties
Client
Gets the TCP client for the player connection.
public TcpClient Client { get; }Property Value
ConnectedAt
Gets the timestamp at which the player connected.
public DateTimeOffset ConnectedAt { get; }Property Value
Context
Gets the context that owns player-scoped services and network resources.
public IPlayerContext Context { get; }Property Value
IdentifiedKey
Gets or sets the identified chat key supplied by protocol versions 1.19 through 1.19.2.
public IdentifiedKey? IdentifiedKey { get; set; }Property Value
Name
Gets the player’s display name.
public string Name { get; }Property Value
Remarks
This returns
Phase
Gets or sets the current protocol phase of the player connection.
public Phase Phase { get; set; }Property Value
Profile
Gets or sets the player’s game profile after it becomes available.
public GameProfile? Profile { get; set; }Property Value
ProtocolVersion
Gets the detected Java Edition protocol version.
public ProtocolVersion ProtocolVersion { get; }Property Value
RemoteEndPoint
Gets the formatted remote endpoint captured when the player connected.
public string RemoteEndPoint { get; }Property Value
Methods
Dispose()
Disposes the player context and suppresses finalization for this instance.
public void Dispose()DisposeAsync()
Asynchronously disposes the player context and suppresses finalization for this instance.
public ValueTask DisposeAsync()Returns
A task that completes when context disposal finishes.
Equals(IPlayer?)
Determines whether another player has the same stable player hash code.
public bool Equals(IPlayer? other)Parameters
other IPlayer?
The player to compare, or null.
Returns
true when both players have the same stable hash code; otherwise, false.
ToString()
Returns the authenticated profile name when available, otherwise the captured remote endpoint.
public override string ToString()Returns
The profile username or remote endpoint text.