Fixed SaveSSI on kick potentially breaking

Added method to save an inventory in SSI to TSPlayer
This commit is contained in:
Lucas Nicodemus 2012-05-25 20:03:27 -06:00
parent e821236a04
commit b8c2c1aded
3 changed files with 28 additions and 3 deletions

View file

@ -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>