Skip to content

Class LinkExtensions

Namespace: Void.Minecraft.Links.Extensions
Assembly: Void.Minecraft.dll

Provides packet-oriented send operations for player-to-server links.

public static class LinkExtensions

Inheritance

objectLinkExtensions

Inherited Members

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

Methods

Constructs and sends a parameterless Minecraft message to the side implied by its marker interface.

public static ValueTask SendPacketAsync<T>(this ILink link, CancellationToken cancellationToken) where T : class, IMinecraftMessage, new()

Parameters

link ILink

The link through which the message is sent.

cancellationToken CancellationToken

A token used to cancel sending and event publication.

Returns

ValueTask

A task that completes after the message is sent and the sent event is processed.

Type Parameters

T

The message type to construct and send.

Exceptions

InvalidOperationException

T is neither clientbound nor serverbound.

Sends a Minecraft message to the side implied by its marker interface.

public static ValueTask SendPacketAsync<T>(this ILink link, T packet, CancellationToken cancellationToken) where T : class, IMinecraftMessage

Parameters

link ILink

The link through which the message is sent.

packet T

The message instance to send.

cancellationToken CancellationToken

A token used to cancel sending and event publication.

Returns

ValueTask

A task that completes after the message is sent and the sent event is processed.

Type Parameters

T

The message type.

Exceptions

InvalidOperationException

packet is neither clientbound nor serverbound.

Sends a Minecraft message to an explicitly selected link side and publishes a corresponding message-sent event.

public static ValueTask SendPacketAsync<T>(this ILink link, Side side, T packet, CancellationToken cancellationToken) where T : IMinecraftMessage

Parameters

link ILink

The link through which the message is sent.

side Side

The destination side. uses the player channel and uses the server channel.

packet T

The message instance to send.

cancellationToken CancellationToken

A token used to cancel sending and event publication.

Returns

ValueTask

A task that completes after the message is sent and the sent event is processed.

Type Parameters

T

The message type.

Exceptions

InvalidOperationException

side is .