using System; using System.Net; namespace RageCoop.Server.Scripting; /// /// public class ChatEventArgs : EventArgs { /// /// The client that sent this message, will be null if sent from server /// public Client Client { get; set; } /// /// Message /// public string Message { get; set; } /// /// Only used when sending a message via /// public string ClaimedSender { get; set; } } /// /// public class CustomEventReceivedArgs : Core.Scripting.CustomEventReceivedArgs { /// /// The that triggered this event /// public Client Client { get => Tag as Client; set => Tag = value; } public static CustomEventReceivedArgs From(Core.Scripting.CustomEventReceivedArgs e) { return new CustomEventReceivedArgs { Args = e.Args, Tag = e.Tag, Hash = e.Hash, }; } } /// /// public class OnCommandEventArgs : EventArgs { /// /// The that executed this command, will be null if sent from server. /// public Client Client { get; set; } /// /// The name of executed command /// public string Name { get; set; } /// /// Arguments /// public string[] Args { get; set; } /// /// If this value was set to true, corresponding handler registered with /// will not be invoked. /// public bool Cancel { get; set; } = false; } /// /// public class HandshakeEventArgs : EventArgs { /// /// The player's ID /// public int ID { get; set; } /// /// The claimed username /// public string Username { get; set; } /// /// The client password hashed with SHA256 algorithm. /// public string PasswordHash { get; set; } /// /// The that sent the handshake request. /// public IPEndPoint EndPoint { get; set; } internal string DenyReason { get; set; } internal bool Cancel { get; set; } /// /// Deny the connection attempt /// /// public void Deny(string reason) { DenyReason = reason; Cancel = true; } }