From 763519150a5a4ab4fdca7435cdf0dfa8c3d3e246 Mon Sep 17 00:00:00 2001
From: AkjaHAsLk1IALk0MasH <46046453+AgaSpace@users.noreply.github.com>
Date: Sun, 14 May 2023 10:33:54 +0700
Subject: [PATCH] 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.
---
TShockAPI/PlayerData.cs | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/TShockAPI/PlayerData.cs b/TShockAPI/PlayerData.cs
index aae27672..b2866eb1 100644
--- a/TShockAPI/PlayerData.cs
+++ b/TShockAPI/PlayerData.cs
@@ -96,12 +96,22 @@ namespace TShockAPI
///
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));
+ }
+
+ ///
+ /// Stores an item at the specific storage slot
+ ///
+ ///
+ ///
+ 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;
}
- this.inventory[slot] = new NetItem(netID, stack, prefix);
+ this.inventory[slot] = item;
}
///