Files
RAGECOOP-V/Server/Scripting/EventArgs/EventArgs.cs

109 lines
2.8 KiB
C#
Raw Normal View History

2022-06-04 18:09:42 +08:00
using System;
using System.Net;
2022-10-23 19:02:39 +08:00
namespace RageCoop.Server.Scripting;
/// <summary>
/// </summary>
public class ChatEventArgs : EventArgs
2022-06-04 18:09:42 +08:00
{
2022-07-01 13:54:18 +08:00
/// <summary>
2022-10-23 19:02:39 +08:00
/// The client that sent this message, will be null if sent from server
2022-07-01 13:54:18 +08:00
/// </summary>
2022-10-23 19:02:39 +08:00
public Client Client { get; set; }
2022-07-01 13:54:18 +08:00
/// <summary>
2022-10-23 19:02:39 +08:00
/// Message
2022-07-01 13:54:18 +08:00
/// </summary>
2022-10-23 19:02:39 +08:00
public string Message { get; set; }
2022-07-01 13:54:18 +08:00
/// <summary>
2022-10-23 19:02:39 +08:00
/// Only used when sending a message via <see cref="API.SendChatMessage(string, List{Client}, string, bool?)" />
2022-07-01 13:54:18 +08:00
/// </summary>
2022-10-23 19:02:39 +08:00
public string ClaimedSender { get; set; }
}
/// <summary>
/// </summary>
public class CustomEventReceivedArgs : EventArgs
{
/// <summary>
/// The <see cref="RageCoop.Server.Client" /> that triggered this event
/// </summary>
public Client Client { get; set; }
/// <summary>
/// The event hash
/// </summary>
public int Hash { get; set; }
/// <summary>
/// Supported types: byte, short, ushort, int, uint, long, ulong, float, bool, string, Vector3, Quaternion, Vector2
/// <see cref="ServerObject.Handle" />
/// </summary>
public object[] Args { get; set; }
}
/// <summary>
/// </summary>
public class OnCommandEventArgs : EventArgs
{
/// <summary>
/// The <see cref="RageCoop.Server.Client" /> that executed this command, will be null if sent from server.
/// </summary>
public Client Client { get; set; }
2022-07-01 13:54:18 +08:00
/// <summary>
2022-10-23 19:02:39 +08:00
/// The name of executed command
2022-07-01 13:54:18 +08:00
/// </summary>
2022-10-23 19:02:39 +08:00
public string Name { get; set; }
/// <summary>
/// Arguments
/// </summary>
public string[] Args { get; set; }
/// <summary>
/// If this value was set to true, corresponding handler registered with
/// <see cref="API.RegisterCommand(string, Action{CommandContext})" /> will not be invoked.
/// </summary>
public bool Cancel { get; set; } = false;
}
/// <summary>
/// </summary>
public class HandshakeEventArgs : EventArgs
{
/// <summary>
/// The player's ID
/// </summary>
public int ID { get; set; }
/// <summary>
/// The claimed username
/// </summary>
public string Username { get; set; }
/// <summary>
/// The client password hashed with SHA256 algorithm.
/// </summary>
public string PasswordHash { get; set; }
/// <summary>
/// The <see cref="EndPoint" /> that sent the handshake request.
/// </summary>
public IPEndPoint EndPoint { get; set; }
internal string DenyReason { get; set; }
internal bool Cancel { get; set; }
/// <summary>
/// Deny the connection attempt
/// </summary>
/// <param name="reason"></param>
public void Deny(string reason)
2022-06-04 18:09:42 +08:00
{
2022-10-23 19:02:39 +08:00
DenyReason = reason;
Cancel = true;
2022-06-04 18:09:42 +08:00
}
2022-10-23 19:02:39 +08:00
}