diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index bffc67ea..1dae17fd 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -437,6 +437,8 @@ namespace TShockAPI args.Player.LoginHarassed = false; } + + Hooks.PlayerLoginEvent.OnPlayerLogin(args.Player); } else { diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 6b34735b..c085a31b 100644 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -1384,6 +1384,7 @@ namespace TShockAPI } args.Player.SendMessage("Authenticated as " + args.Player.Name + " successfully.", Color.LimeGreen); Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user " + args.Player.Name + "."); + Hooks.PlayerLoginEvent.OnPlayerLogin(args.Player); return true; } TShock.Utils.ForceKick(args.Player, "Invalid user account password.", true); diff --git a/TShockAPI/Hooks/PlayerLoginEvent.cs b/TShockAPI/Hooks/PlayerLoginEvent.cs new file mode 100644 index 00000000..b533720f --- /dev/null +++ b/TShockAPI/Hooks/PlayerLoginEvent.cs @@ -0,0 +1,32 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; + +namespace TShockAPI.Hooks +{ + class PlayerLoginEventArgs + { + public TSPlayer Player { get; set; } + public PlayerLoginEventArgs(TSPlayer ply) + { + Player = ply; + } + } + + class PlayerLoginEvent + { + public delegate void PlayerLoginD(PlayerLoginEventArgs e); + public static event PlayerLoginD PlayerLogin; + public static void OnPlayerLogin(TSPlayer ply) + { + if(PlayerLogin == null) + { + return; + } + + PlayerLoginEventArgs args = new PlayerLoginEventArgs(ply); + PlayerLogin(args); + } + } +} diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 468a4a30..42902da7 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -86,6 +86,7 @@ + @@ -188,7 +189,7 @@ - +