Skip to content

Commit

Permalink
Fix registering events, add missing parameters in template plugin (#18)
Browse files Browse the repository at this point in the history
* Add analyzers

* Add analyzers

* Added more advanced event cancellation.

* Fix

* Added manual handling of preauth event

* Update API

* Fix registering events and add missing parameters

Co-authored-by: Łukasz Jurczyk <[email protected]>
  • Loading branch information
Killers0992 and zabszk authored Sep 21, 2022
1 parent ea63a03 commit bc6daf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion NwPluginAPI/Events/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ private static bool ValidateEvent(Type[] parameters, Type[] requiredParameters)
public static void RegisterEvents(object plugin)
{
Type type = plugin.GetType();
RegisterEvents(type, type);
RegisterEvents(type, plugin);
}

/// <summary>
Expand Down
4 changes: 3 additions & 1 deletion TemplatePlugin/MainClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using InventorySystem.Items.Firearms;
using InventorySystem.Items.Radio;
using InventorySystem.Items.Usables;
using LiteNetLib;
using MapGeneration.Distributors;
using PlayerRoles;
using PlayerStatsSystem;
Expand All @@ -14,6 +15,7 @@
using PluginAPI.Core.Interfaces;
using PluginAPI.Enums;
using PluginAPI.Events;
using System;
using TemplatePlugin.Factory;
using ItemPickupBase = InventorySystem.Items.Pickups.ItemPickupBase;

Expand Down Expand Up @@ -254,7 +256,7 @@ void OnPlayerPickupScp330(MyPlayer plr, ItemPickupBase pickup)
}

[PluginEvent(ServerEventType.PlayerPreauth)]
void OnPreauth(string userid, string ipAddress, long expiration, CentralAuthPreauthFlags flags, string country, byte[] signature)
void OnPreauth(string userid, string ipAddress, long expiration, CentralAuthPreauthFlags flags, string country, byte[] signature, ConnectionRequest req, Int32 index)
{
Log.Info($"Player &6{userid}&r (&6{ipAddress}&r) preauthenticated from country &6{country}&r with central flags &6{flags}&r");
}
Expand Down

0 comments on commit bc6daf2

Please sign in to comment.