Calling Kill console spamSuggestion

I was getting a lot of console spam: (more than 3 lines, like 15-30)

Calling kill - but already IsDestroyed!? loot_barrel_1
Calling kill - but already IsDestroyed!? loot_barrel_2
Calling kill - but already IsDestroyed!? oil_barrel

I ran PowerShell (as admin) with this search parameter:

Select-String -Path "D:\{path to your server}\plugins\*.cs" -Pattern "Kill("
This gave me a list of plugins with those keywords.  I looked at the least updated one (this plugin)

I changed a bit of code at the end of the plugin and it stopped the console spam without effecting the plugin's funcationality.

Here is the code: (lines 176 to 197)

 // Check the barrel/roadsign is empty
            if (lootContainerInventory.itemList == null || lootContainerInventory.itemList.Count <= 0)
            {
                NextTick(() =>
				{
					// Call the OnEntityDeath callback.
					Interface.CallHook("OnEntityDeath", LootEntContainer, HitEntInfo);

					if (LootEntContainer == null || LootEntContainer.IsDestroyed)
						return; // Prevent redundant kill and log spam

					// Kill the barrel/roadsign with or without gibs depending on permission
					if (permission.UserHasPermission(player.UserIDString, $"AutoPickupBarrel.{AutoPickupPrefab}.NoGibs"))
					{
						LootEntContainer.Kill();
					}
					else
					{
						LootEntContainer.Kill(BaseNetworkable.DestroyMode.Gib);
					}
				});
            }

This completely nullified the console spam.

 

after a few hours, not 100% but reduced it.  (so far)