Move FixChestStacks() to utils
This commit is contained in:
parent
9c6c450751
commit
7c47fbb3f2
2 changed files with 20 additions and 20 deletions
|
|
@ -876,7 +876,7 @@ namespace TShockAPI
|
||||||
Warps.ReloadWarps();
|
Warps.ReloadWarps();
|
||||||
|
|
||||||
ComputeMaxStyles();
|
ComputeMaxStyles();
|
||||||
FixChestStacks();
|
Utils.FixChestStacks();
|
||||||
|
|
||||||
Utils.UpgradeMotD();
|
Utils.UpgradeMotD();
|
||||||
|
|
||||||
|
|
@ -909,25 +909,6 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>FixChestStacks - Verifies that each stack in each chest is valid and not over the max stack count.</summary>
|
|
||||||
private void FixChestStacks()
|
|
||||||
{
|
|
||||||
if (Config.IgnoreChestStacksOnLoad)
|
|
||||||
return;
|
|
||||||
|
|
||||||
foreach (Chest chest in Main.chest)
|
|
||||||
{
|
|
||||||
if (chest != null)
|
|
||||||
{
|
|
||||||
foreach (Item item in chest.item)
|
|
||||||
{
|
|
||||||
if (item != null && item.stack > item.maxStack)
|
|
||||||
item.stack = item.maxStack;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>LastCheck - Used to keep track of the last check for basically all time based checks.</summary>
|
/// <summary>LastCheck - Used to keep track of the last check for basically all time based checks.</summary>
|
||||||
private DateTime LastCheck = DateTime.UtcNow;
|
private DateTime LastCheck = DateTime.UtcNow;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1427,5 +1427,24 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>FixChestStacks - Verifies that each stack in each chest is valid and not over the max stack count.</summary>
|
||||||
|
public void FixChestStacks()
|
||||||
|
{
|
||||||
|
if (TShock.Config.IgnoreChestStacksOnLoad)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foreach (Chest chest in Main.chest)
|
||||||
|
{
|
||||||
|
if (chest != null)
|
||||||
|
{
|
||||||
|
foreach (Item item in chest.item)
|
||||||
|
{
|
||||||
|
if (item != null && item.stack > item.maxStack)
|
||||||
|
item.stack = item.maxStack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue