Updated the PlayerData.StoreSlot method

Removed the ability to call a method when a slot less than 0 is specified.

Added an overload that takes `NetItem` in parameters.
This commit is contained in:
AkjaHAsLk1IALk0MasH 2023-05-14 10:33:54 +07:00
parent 2e8823434c
commit 763519150a

View file

@ -96,12 +96,22 @@ namespace TShockAPI
/// <param name="stack"></param> /// <param name="stack"></param>
public void StoreSlot(int slot, int netID, byte prefix, int stack) public void StoreSlot(int slot, int netID, byte prefix, int stack)
{ {
if (slot > (this.inventory.Length - 1)) //if the slot is out of range then dont save StoreSlot(slot, new NetItem(netID, stack, prefix));
}
/// <summary>
/// Stores an item at the specific storage slot
/// </summary>
/// <param name="slot"></param>
/// <param name="item"></param>
public void StoreSlot(int slot, NetItem item)
{
if (slot > (this.inventory.Length - 1) || slot < 0) //if the slot is out of range then dont save
{ {
return; return;
} }
this.inventory[slot] = new NetItem(netID, stack, prefix); this.inventory[slot] = item;
} }
/// <summary> /// <summary>