Change Sender to Client in EventArgs
This commit is contained in:
@ -72,7 +72,7 @@ namespace RageCoop.Server.Scripting
|
||||
{
|
||||
Name=cmdName,
|
||||
Args=cmdArgs,
|
||||
Sender=sender
|
||||
Client=sender
|
||||
};
|
||||
OnCommandReceived?.Invoke(this, args);
|
||||
if (args.Cancel)
|
||||
@ -117,7 +117,7 @@ namespace RageCoop.Server.Scripting
|
||||
|
||||
internal void InvokeCustomEventReceived(Packets.CustomEvent p, Client sender)
|
||||
{
|
||||
var args = new CustomEventReceivedArgs() { Hash=p.Hash, Args=p.Args, Sender=sender };
|
||||
var args = new CustomEventReceivedArgs() { Hash=p.Hash, Args=p.Args, Client=sender };
|
||||
List<Action<CustomEventReceivedArgs>> handlers;
|
||||
if (CustomEventHandlers.TryGetValue(p.Hash, out handlers))
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ namespace RageCoop.Server.Scripting
|
||||
{
|
||||
foreach (var c in API.GetAllClients().Values)
|
||||
{
|
||||
if (c==e.Sender)
|
||||
if (c==e.Client)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@ -39,7 +39,7 @@ namespace RageCoop.Server.Scripting
|
||||
});
|
||||
API.RegisterCustomEventHandler(CustomEvents.OnPlayerDied, (e) =>
|
||||
{
|
||||
API.SendCustomEventQueued(API.GetAllClients().Values.Where(x=>x!=e.Sender).ToList(),CustomEvents.OnPlayerDied,e.Sender.Username);
|
||||
API.SendCustomEventQueued(API.GetAllClients().Values.Where(x=>x!=e.Client).ToList(),CustomEvents.OnPlayerDied,e.Client.Username);
|
||||
});
|
||||
}
|
||||
public override void OnStop()
|
||||
@ -77,12 +77,12 @@ namespace RageCoop.Server.Scripting
|
||||
{
|
||||
int id = (int)e.Args[0];
|
||||
Action<object> callback;
|
||||
lock (e.Sender.Callbacks)
|
||||
lock (e.Client.Callbacks)
|
||||
{
|
||||
if (e.Sender.Callbacks.TryGetValue(id, out callback))
|
||||
if (e.Client.Callbacks.TryGetValue(id, out callback))
|
||||
{
|
||||
callback(e.Args[1]);
|
||||
e.Sender.Callbacks.Remove(id);
|
||||
e.Client.Callbacks.Remove(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace RageCoop.Server.Scripting
|
||||
public class ChatEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The client that sent this message
|
||||
/// The client that sent this message, will be null if sent from server
|
||||
/// </summary>
|
||||
public Client Client { get; set; }
|
||||
/// <summary>
|
||||
@ -32,9 +32,9 @@ namespace RageCoop.Server.Scripting
|
||||
public class CustomEventReceivedArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="Client"/> that triggered this event
|
||||
/// The <see cref="RageCoop.Server.Client"/> that triggered this event
|
||||
/// </summary>
|
||||
public Client Sender { get; set; }
|
||||
public Client Client { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The event hash
|
||||
@ -52,9 +52,9 @@ namespace RageCoop.Server.Scripting
|
||||
public class OnCommandEventArgs : EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// The <see cref="Client"/> that executed this command.
|
||||
/// The <see cref="RageCoop.Server.Client"/> that executed this command, will be null if sent from server.
|
||||
/// </summary>
|
||||
public Client Sender { get; set; }
|
||||
public Client Client { get; set; }
|
||||
/// <summary>
|
||||
/// The name of executed command
|
||||
/// </summary>
|
||||
|
Reference in New Issue
Block a user