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

@ -66,6 +66,12 @@ namespace TShockAPI.Configuration
/// </summary>
[Description("The starting default inventory for new players when SSC is enabled.")]
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>

View file

@ -167,7 +167,7 @@ namespace TShockAPI.DB
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;
}
@ -237,7 +237,7 @@ namespace TShockAPI.DB
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;
}

View file

@ -2411,6 +2411,12 @@ namespace TShockAPI
{
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);
TShock.CharacterDB.InsertPlayerData(args.Player);
}

View file

@ -906,7 +906,7 @@ namespace TShockAPI
{
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;
}
PlayerData.CopyCharacter(this);