Added TSPlayer.Logout()
This commit is contained in:
parent
bcd00c0243
commit
7c8bf7712a
3 changed files with 32 additions and 24 deletions
|
|
@ -3,6 +3,10 @@
|
|||
This is the rolling changelog for TShock for Terraria. Use past tense when adding new entries; sign your name off when you add or change something. This should primarily be things like user changes, not necessarily codebase changes unless it's really relevant or large.
|
||||
|
||||
## Upcoming Changes
|
||||
* API: Version tick 2.0
|
||||
* API: Added TSPlayer.KillPlayer() (@WhiteXZ)
|
||||
* API: Added TSPlayer.Logout() (@ProfessorXZ)
|
||||
* Fixed connections after max slot is reached (@DeathCradle)
|
||||
|
||||
## TShock 4.3.21
|
||||
* Compatibility with Terraria 1.3.4.3 (@Patrikkk, @Zaicon).
|
||||
|
|
@ -26,7 +30,6 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
|||
* Added `/uploadssc [player]` which allows someone to upload SSC data for [player] and store it on the server. Adds `tshock.ssc.upload` and `tshock.ssc.upload.others` permission nodes to match (@DogooFalchion).
|
||||
* Added hardened stone to the whitelist of tiles editable by players (@DogooFalchion).
|
||||
* Added conversion system to send convert old MOTD format into smart text, while preserving initial line starting values to keep byte optimization for background colors Thanks to (@WhiteXZ, @Simon311, and especially @DogooFalchion) for the hard work on this issue.
|
||||
* Fixed server-sided inventory issues caused by bank3 (@ProfessorXZ)
|
||||
|
||||
## TShock 4.3.20
|
||||
* Security improvement: The auth system is now automatically disabled if a superadmin exists in the database (@Enerdy).
|
||||
|
|
|
|||
|
|
@ -892,29 +892,7 @@ namespace TShockAPI
|
|||
return;
|
||||
}
|
||||
|
||||
PlayerHooks.OnPlayerLogout(args.Player);
|
||||
|
||||
|
||||
if (Main.ServerSideCharacter)
|
||||
{
|
||||
args.Player.IgnoreActionsForInventory = String.Format("Server side characters is enabled! Please {0}register or {0}login to play!", Commands.Specifier);
|
||||
if (!args.Player.IgnoreActionsForClearingTrashCan && (!args.Player.Dead || args.Player.TPlayer.difficulty != 2))
|
||||
{
|
||||
args.Player.PlayerData.CopyCharacter(args.Player);
|
||||
TShock.CharacterDB.InsertPlayerData(args.Player);
|
||||
}
|
||||
}
|
||||
|
||||
args.Player.PlayerData = new PlayerData(args.Player);
|
||||
args.Player.Group = TShock.Groups.GetGroupByName(TShock.Config.DefaultGuestGroupName);
|
||||
args.Player.tempGroup = null;
|
||||
if (args.Player.tempGroupTimer != null)
|
||||
{
|
||||
args.Player.tempGroupTimer.Stop();
|
||||
}
|
||||
args.Player.User = null;
|
||||
args.Player.IsLoggedIn = false;
|
||||
|
||||
args.Player.Logout();
|
||||
args.Player.SendSuccessMessage("You have been successfully logged out of your account.");
|
||||
if (Main.ServerSideCharacter)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -637,6 +637,33 @@ namespace TShockAPI
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Logs the player out of an account.
|
||||
/// </summary>
|
||||
public void Logout()
|
||||
{
|
||||
PlayerHooks.OnPlayerLogout(this);
|
||||
if (Main.ServerSideCharacter)
|
||||
{
|
||||
IgnoreActionsForInventory = $"Server side characters is enabled! Please {Commands.Specifier}register or {Commands.Specifier}login to play!";
|
||||
if (!IgnoreActionsForClearingTrashCan && (!Dead || TPlayer.difficulty != 2))
|
||||
{
|
||||
PlayerData.CopyCharacter(this);
|
||||
TShock.CharacterDB.InsertPlayerData(this);
|
||||
}
|
||||
}
|
||||
|
||||
PlayerData = new PlayerData(this);
|
||||
Group = TShock.Groups.GetGroupByName(TShock.Config.DefaultGuestGroupName);
|
||||
tempGroup = null;
|
||||
if (tempGroupTimer != null)
|
||||
{
|
||||
tempGroupTimer.Stop();
|
||||
}
|
||||
User = null;
|
||||
IsLoggedIn = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="TSPlayer"/> class.
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue