IClient interface
public interface IClient : IDisposable
In Obsidian.API.
Properties
Brand
string Brand { get; set; }The client brand. This is the name that the client used to identify itself (Fabric, Forge, Quilt, etc.)
bool Connected { get; }int Id { get; }string Ip { get; }long? LastKeepAliveId { get; set; }ILogger Logger { get; }int Ping { get; set; }Player
IPlayer Player { get; }The player that the client is logged in as.
RandomToken
ReadOnlyMemory<byte> RandomToken { get; }The verify token sent in the encryption request; empty until the request is sent.
Server
IServer Server { get; }The server. During a plugin's calls, like its event handlers, commands and behaviours, it's the plugin's own IServer, whose additions are the plugin's (see BaseMinecraftEventArgs.Server).
SignatureData? SignatureData { get; set; }ClientState State { get; }Methods
ValueTask DisconnectAsync(ChatMessage reason);HasChannel(string)
bool HasChannel(string channel);Whether the connection may receive payloads on channel in its current phase: a vanilla channel, one negotiated with a NeoForge client, or one the client registered with minecraft:register or c:register.
QueuePacketAsync(IClientboundPacket)
ValueTask QueuePacketAsync(IClientboundPacket packet);Queues a packet in the client's outgoing pipeline, where packet handlers see it in order before it's sent. The call never waits for the handlers.
SendPacket(IClientboundPacket)
bool SendPacket(IClientboundPacket packet);Sends a packet without packet handlers: immediately, or right after the packets queued before it that are still on their way.
Returns
Whether the packet was sent or is on its way.
SendPayloadAsync<TPayload>(TPayload)
ValueTask<bool> SendPayloadAsync<TPayload>(TPayload payload) where TPayload : ICustomPayload<TPayload>;Sends payload if the connection may receive its channel (see IClient.HasChannel).
Returns
Whether the payload was queued.
void SetState(ClientState state);ValueTask<bool> VerifyProfileAsync();