using System.Collections.Generic; using System.Threading.Tasks; using Impostor.Api.Innersloth; using Impostor.Api.Net.Messages; namespace Impostor.Api.Net { /// /// Represents a connected game client. /// public interface IClient { /// /// Gets or sets the unique ID of the client. /// /// /// This ID is generated when the client is registered in the client manager and should not be used /// to store persisted data. /// int Id { get; set; } /// /// Gets the name that was provided by the player in the client. /// /// /// The name is provided by the player and should not be used to store persisted data. /// string Name { get; } /// /// Gets the connection of the client. /// /// /// Null when the client was not registered by the matchmaker. /// IHazelConnection? Connection { get; } /// /// Gets a key/value collection that can be used to share data between messages. /// /// /// /// The stored data will not be saved. /// After the connection has been closed all data will be lost. /// /// /// Note that the values will not be disposed after the connection has been closed. /// This has to be implemented by the plugin. /// /// IDictionary Items { get; } /// /// Gets or sets the current game data of the . /// IClientPlayer? Player { get; } ValueTask HandleMessageAsync(IMessageReader message, MessageType messageType); ValueTask HandleDisconnectAsync(string reason); /// /// Disconnect the client with a . /// /// /// The message to show to the player. /// /// /// Only used when is set to . /// /// /// A representing the asynchronous operation. /// ValueTask DisconnectAsync(DisconnectReason reason, string? message = null); } }