Added Hook for player login, for plugin sake, now they can utilize the login before join.
This commit is contained in:
parent
673f25f881
commit
c37cc91ca0
4 changed files with 37 additions and 1 deletions
|
|
@ -437,6 +437,8 @@ namespace TShockAPI
|
||||||
args.Player.LoginHarassed = false;
|
args.Player.LoginHarassed = false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Hooks.PlayerLoginEvent.OnPlayerLogin(args.Player);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1384,6 +1384,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
args.Player.SendMessage("Authenticated as " + args.Player.Name + " successfully.", Color.LimeGreen);
|
args.Player.SendMessage("Authenticated as " + args.Player.Name + " successfully.", Color.LimeGreen);
|
||||||
Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user " + args.Player.Name + ".");
|
Log.ConsoleInfo(args.Player.Name + " authenticated successfully as user " + args.Player.Name + ".");
|
||||||
|
Hooks.PlayerLoginEvent.OnPlayerLogin(args.Player);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
TShock.Utils.ForceKick(args.Player, "Invalid user account password.", true);
|
TShock.Utils.ForceKick(args.Player, "Invalid user account password.", true);
|
||||||
|
|
|
||||||
32
TShockAPI/Hooks/PlayerLoginEvent.cs
Normal file
32
TShockAPI/Hooks/PlayerLoginEvent.cs
Normal file
|
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -86,6 +86,7 @@
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BackupManager.cs" />
|
<Compile Include="BackupManager.cs" />
|
||||||
<Compile Include="DB\RegionManager.cs" />
|
<Compile Include="DB\RegionManager.cs" />
|
||||||
|
<Compile Include="Hooks\PlayerLoginEvent.cs" />
|
||||||
<Compile Include="SaveManager.cs" />
|
<Compile Include="SaveManager.cs" />
|
||||||
<Compile Include="DB\BanManager.cs" />
|
<Compile Include="DB\BanManager.cs" />
|
||||||
<Compile Include="DB\InventoryManager.cs" />
|
<Compile Include="DB\InventoryManager.cs" />
|
||||||
|
|
@ -188,7 +189,7 @@
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ProjectExtensions>
|
<ProjectExtensions>
|
||||||
<VisualStudio>
|
<VisualStudio>
|
||||||
<UserProperties BuildVersion_IncrementBeforeBuild="False" BuildVersion_StartDate="2011/6/17" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_BuildAction="Both" BuildVersion_UpdateFileVersion="True" BuildVersion_UpdateAssemblyVersion="True" />
|
<UserProperties BuildVersion_UpdateAssemblyVersion="True" BuildVersion_UpdateFileVersion="True" BuildVersion_BuildAction="Both" BuildVersion_BuildVersioningStyle="None.None.None.MonthAndDayStamp" BuildVersion_StartDate="2011/6/17" BuildVersion_IncrementBeforeBuild="False" />
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue