Logout players when their user account is removed
This commit is contained in:
parent
ce6dc577cb
commit
f5ccf925bd
1 changed files with 5 additions and 1 deletions
|
|
@ -95,13 +95,17 @@ namespace TShockAPI.DB
|
|||
{
|
||||
try
|
||||
{
|
||||
var tempuser = GetUserAccount(account);
|
||||
// Logout any player logged in as the account to be removed
|
||||
TShock.Players.Where(p => p?.IsLoggedIn == true && p.Account.Name == account.Name).ForEach(p => p.Logout());
|
||||
|
||||
UserAccount tempuser = GetUserAccount(account);
|
||||
int affected = _database.Query("DELETE FROM Users WHERE Username=@0", account.Name);
|
||||
|
||||
if (affected < 1)
|
||||
throw new UserAccountNotExistException(account.Name);
|
||||
|
||||
Hooks.AccountHooks.OnAccountDelete(tempuser);
|
||||
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue