From 63231c73f2fa021c2c6400628a2e705af999840f Mon Sep 17 00:00:00 2001 From: Zack Date: Sun, 22 Feb 2015 16:17:05 -0500 Subject: [PATCH] Utilize new account hooks to insert and delete from the SSC table, since this is what the feature was intended for. --- TShockAPI/Commands.cs | 2 -- TShockAPI/TShock.cs | 16 ++++++++++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index ec378ae0..b2162eab 100755 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -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); } diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 04a4551f..1346113a 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -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)