Utilize new account hooks to insert and delete from the SSC table, since this is what the feature was intended for.

This commit is contained in:
Zack 2015-02-22 16:17:05 -05:00
parent 68afd6fcc6
commit 63231c73f2
2 changed files with 14 additions and 4 deletions

View file

@ -265,8 +265,10 @@ namespace TShockAPI
ServerApi.Hooks.WorldChristmasCheck.Register(this, OnXmasCheck);
ServerApi.Hooks.WorldHalloweenCheck.Register(this, OnHalloweenCheck);
ServerApi.Hooks.NetNameCollision.Register(this, NetHooks_NameCollision);
TShockAPI.Hooks.PlayerHooks.PlayerPreLogin += OnPlayerPreLogin;
TShockAPI.Hooks.PlayerHooks.PlayerPostLogin += OnPlayerLogin;
Hooks.PlayerHooks.PlayerPreLogin += OnPlayerPreLogin;
Hooks.PlayerHooks.PlayerPostLogin += OnPlayerLogin;
Hooks.AccountHooks.AccountDelete += OnAccountDelete;
Hooks.AccountHooks.AccountCreate += OnAccountCreate;
GetDataHandlers.InitGetDataHandler();
Commands.InitCommands();
@ -379,6 +381,16 @@ namespace TShockAPI
Users.UpdateLogin(u);
}
private void OnAccountDelete(Hooks.AccountDeleteEventArgs args)
{
CharacterDB.RemovePlayer(args.User.ID);
}
private void OnAccountCreate(Hooks.AccountCreateEventArgs args)
{
CharacterDB.SeedInitialData(Users.GetUser(args.User));
}
private void OnPlayerPreLogin(Hooks.PlayerPreLoginEventArgs args)
{
if (args.Player.IsLoggedIn)