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

@ -878,7 +878,6 @@ namespace TShockAPI
args.Player.SendSuccessMessage("Account \"{0}\" has been registered.", user.Name);
args.Player.SendSuccessMessage("Your password is {0}.", user.Password);
TShock.Users.AddUser(user);
TShock.CharacterDB.SeedInitialData(TShock.Users.GetUser(user));
Log.ConsoleInfo("{0} registered an account: \"{1}\".", args.Player.Name, user.Name);
}
else
@ -919,7 +918,6 @@ namespace TShockAPI
try
{
TShock.Users.AddUser(user);
TShock.CharacterDB.SeedInitialData(TShock.Users.GetUser(user));
args.Player.SendSuccessMessage("Account " + user.Name + " has been added to group " + user.Group + "!");
Log.ConsoleInfo(args.Player.Name + " added Account " + user.Name + " to group " + user.Group);
}

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)