From 36c8293a37bf9c0b94e91383a871a704a531478b Mon Sep 17 00:00:00 2001 From: galaxy119 Date: Wed, 19 Aug 2020 20:26:24 -0700 Subject: [PATCH] Fix for dummy and inventory dupe --- AdminTools/EventHandlers.cs | 10 ++++------ AdminTools/Jailed.cs | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/AdminTools/EventHandlers.cs b/AdminTools/EventHandlers.cs index 843def1..23f8ccd 100644 --- a/AdminTools/EventHandlers.cs +++ b/AdminTools/EventHandlers.cs @@ -1510,7 +1510,6 @@ private void SpawnDummyModel(Vector3 position, Quaternion rotation, RoleType rol if (ccm == null) Log.Error("CCM is null, doufus. You need to do this the harder way."); ccm.CurClass = role; - ccm.RefreshPlyModel(); obj.GetComponent().Network_myNickSync = "Dummy"; obj.GetComponent().PlayerId = 9999; obj.GetComponent().NetworkPlayerId = 9999; @@ -1656,15 +1655,15 @@ public IEnumerator DoRocket(Player player, float speed) public IEnumerator DoJail(Player player, bool skipadd = false) { - List items = new List(); + List items = new List(); foreach (Inventory.SyncItemInfo item in player.Inventory.items) - items.Add(item.id); + items.Add(item); if (!skipadd) plugin.JailedPlayers.Add(new Jailed { Health = player.Health, Position = player.Position, - Items = items, + Items = items, Name = player.Nickname, Role = player.Role, Userid = player.UserId, @@ -1681,8 +1680,7 @@ private IEnumerator DoUnJail(Player player) { Jailed jail = plugin.JailedPlayers.Find(j => j.Userid == player.UserId); player.Role = jail.Role; - foreach (ItemType item in jail.Items) - player.Inventory.AddNewItem(item); + player.ResetInventory(jail.Items); yield return Timing.WaitForSeconds(1.5f); player.Health = jail.Health; player.Position = jail.Position; diff --git a/AdminTools/Jailed.cs b/AdminTools/Jailed.cs index 91b7287..e59e005 100644 --- a/AdminTools/Jailed.cs +++ b/AdminTools/Jailed.cs @@ -7,7 +7,7 @@ public class Jailed { public string Userid; public string Name; - public List Items; + public List Items; public RoleType Role; public Vector3 Position; public float Health;