Fixed SaveSSI on kick potentially breaking
Added method to save an inventory in SSI to TSPlayer
This commit is contained in:
parent
e821236a04
commit
b8c2c1aded
3 changed files with 28 additions and 3 deletions
|
|
@ -119,6 +119,29 @@ namespace TShockAPI
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves the player's inventory to SSI
|
||||
/// </summary>
|
||||
/// <returns>bool - True/false if it saved successfully</returns>
|
||||
public bool SaveServerInventory()
|
||||
{
|
||||
if (!TShock.Config.ServerSideInventory)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
try
|
||||
{
|
||||
PlayerData.CopyInventory(this);
|
||||
TShock.InventoryDB.InsertPlayerData(this);
|
||||
return true;
|
||||
} catch (Exception e)
|
||||
{
|
||||
Log.Error(e.Message);
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Terraria Player
|
||||
/// </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue