Warn players if bypass SSC permission is enabled

If a player has the tshock.ignore.ssc permission, odds are that they may
want to know that their data isn't being saved or not. This change
allows users to be notified if they have SSC data stored in the DB but
they aren't having it loaded due to the aforementioned permission.

This permission causes great confusion, but we can't really change it
because we would break existing setups. This is an easy change that
gives people a reason why they suddenly "have no items."

This new option can be turned off in the config file for SSC if it's not
desired.

This change also modifies some of the log messages so that it's clear
why the SSC save didn't occur for a given player.
This commit is contained in:
Lucas Nicodemus 2021-05-21 01:16:04 -07:00
parent c9b13b493e
commit 68ae73ffef
5 changed files with 16 additions and 3 deletions

View file

@ -22,6 +22,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* The default MOTD is now prettier. The MOTD format can now contain `%specifier%` to send the command specifier. (@moisterrific) * The default MOTD is now prettier. The MOTD format can now contain `%specifier%` to send the command specifier. (@moisterrific)
* The buff commands now support `-1` as a time option to set buffs that last 415 days (the maximum buff time the game supports). (@moisterrific) * The buff commands now support `-1` as a time option to set buffs that last 415 days (the maximum buff time the game supports). (@moisterrific)
* TShock defaults to saving backups every 10 minutes, and defaults to keeping backups for 4 hours. (@hakusaro) * TShock defaults to saving backups every 10 minutes, and defaults to keeping backups for 4 hours. (@hakusaro)
* Updated SSC bypass messaging. Now, when you connect, you're told if you're bypassing SSC. Console logging has been improved to warn when players are not being saved due to the bypass SSC permission. To turn this warning off, change `WarnPlayersAboutBypassPermission` to `false` in the `sscconfig.json` file. (@hakusaro)
## TShock 4.5.2 ## TShock 4.5.2
* Added preliminary support for Terraria 1.4.2.2. (@hakusaro) * Added preliminary support for Terraria 1.4.2.2. (@hakusaro)

View file

@ -66,6 +66,12 @@ namespace TShockAPI.Configuration
/// </summary> /// </summary>
[Description("The starting default inventory for new players when SSC is enabled.")] [Description("The starting default inventory for new players when SSC is enabled.")]
public List<NetItem> StartingInventory = new List<NetItem>(); public List<NetItem> StartingInventory = new List<NetItem>();
/// <summary>
/// Warns players that they have the bypass SSC permission enabled. To disable warning, turn this off.
/// </summary>
[Description("Warns players and the console if a player has the tshock.ignore.ssc permission with data in the SSC table.")]
public bool WarnPlayersAboutBypassPermission = true;
} }
/// <summary> /// <summary>

View file

@ -167,7 +167,7 @@ namespace TShockAPI.DB
if (player.HasPermission(Permissions.bypassssc) && !fromCommand) if (player.HasPermission(Permissions.bypassssc) && !fromCommand)
{ {
TShock.Log.ConsoleInfo("Skipping SSC Backup for " + player.Account.Name); // Debug code TShock.Log.ConsoleInfo("Skipping SSC save (due to tshock.ignore.ssc) for " + player.Account.Name);
return false; return false;
} }
@ -237,7 +237,7 @@ namespace TShockAPI.DB
if (player.HasPermission(Permissions.bypassssc)) if (player.HasPermission(Permissions.bypassssc))
{ {
TShock.Log.ConsoleInfo("Skipping SSC Backup for " + player.Account.Name); // Debug code TShock.Log.ConsoleInfo("Skipping SSC save (due to tshock.ignore.ssc) for " + player.Account.Name);
return true; return true;
} }

View file

@ -2411,6 +2411,12 @@ namespace TShockAPI
{ {
if (args.Player.HasPermission(Permissions.bypassssc)) if (args.Player.HasPermission(Permissions.bypassssc))
{ {
if (args.Player.PlayerData.exists && TShock.ServerSideCharacterConfig.Settings.WarnPlayersAboutBypassPermission)
{
args.Player.SendWarningMessage("Bypass SSC is enabled for your account. SSC data will not be loaded or saved.");
TShock.Log.ConsoleInfo(args.Player.Name + " has SSC data in the database, but has the tshock.ignore.ssc permission. This means their SSC data is being ignored.");
TShock.Log.ConsoleInfo("You may wish to consider removing the tshock.ignore.ssc permission or negating it for this player.");
}
args.Player.PlayerData.CopyCharacter(args.Player); args.Player.PlayerData.CopyCharacter(args.Player);
TShock.CharacterDB.InsertPlayerData(args.Player); TShock.CharacterDB.InsertPlayerData(args.Player);
} }

View file

@ -906,7 +906,7 @@ namespace TShockAPI
{ {
if (HasPermission(Permissions.bypassssc)) if (HasPermission(Permissions.bypassssc))
{ {
TShock.Log.ConsoleInfo("Skipping SSC Backup for " + Account.Name); // Debug Code TShock.Log.ConsoleInfo("Skipping SSC save (due to tshock.ignore.ssc) for " + Account.Name);
return true; return true;
} }
PlayerData.CopyCharacter(this); PlayerData.CopyCharacter(this);