Closed tysonstrange closed 9 years ago
Suggestion...incase the ssc perm is added to the players group after their login and/or to a temp group they're in.
if (Main.ServerSideCharacter && (DateTime.UtcNow - LastSave).TotalMinutes >= ServerSideCharacterConfig.ServerSideCharacterSave)
{
foreach (TSPlayer player in Players)
{
// prevent null point exceptions
if (player != null && player.IsLoggedIn && !player.IgnoreActionsForClearingTrashCan)
{
if ((player.tempGroup != null && player.tempGroup.HasPermission(Permissions.bypassssc)) || player.Group.HasPermission(Permissions.bypassssc))
{
TShock.Log.ConsoleInfo("Skipping SSC Backup for " + player.Name);
continue;
}
CharacterDB.InsertPlayerData(player);
}
}
LastSave = DateTime.UtcNow;
}
Using this code on my server live terraria.tls.id.au and it seems to be working fine.
I use this because of the minigames on my server, I add users to tempgroups and set new inventories dependant on the minigame type and I dont want the server saving over the players ACTUAL inventory with the (mostly empty) minigame inventory.
So far its running as desired, the main reason is to prevent inventory loss on unexpected server crash while a game is running
As for disconnect/logout, the minigame players dont have permission to log out and my minigame plugins handle backup/restore of inventory On game join/end as well as leaving the server, similar to the way the Invsee plugin works. The only issue is/was these periodic SSC backups not checking the ignore ssc perms.
Similar code should be added to savessc command and handled when using /exit
Thanks for the report an PR. Just letting you know that we're not ignoring you, we've all just got a massive amount less free time since school started for half of us and whatnot. If I get home and remember I'll get right onto checking this out and checking out your PR.
Willing to go +1 after someone else reviews to prevent conflict of interest
If you're running an SSC enabled server and move a player into a temp group that has the permission ignoressc the player's inventory is still periodically saved over as per the SSC Config.
The SSC Save interval checks the following: if (player != null && player.IsLoggedIn && !player.IgnoreActionsForClearingTrashCan)
IgnoreActionsForClearingTrashCan is set on login if the player has the ignoressc perm, but not periodically when the ssc save occurs.
Coupld the save internal also be set to check for ignoressc perms?