Nice work. Can you add another permission like stacksizecontroller.canuse to only allow the players who have the permission to use this function?
Stack Size Controller
Allows you to set the max stack size of every item.
Total Downloads: 39,408 - First Release: Feb 10, 2017 - Last Update: Oct 27, 2017
- 5/5, 50 likes
-
-
-
this plugin does not work. is there an update?
-
-
Hi is there a default file so I can save it a backup
-
Also no working for me,just nothing happend i use .json from last page and nothing :/
-
-
Cannot get the controller to work, the stack sizes just stay vanilla sizes. Any help would be appreciated
-
-
-
Last edited by a moderator: Jun 28, 2017
-
@Canopy Sheep Here's a fix for moving over max stack, and splitting stack *in half* with the new modified hooks
Code:object CanMoveItem(Item item, PlayerInventory inventory, uint container, int slot, uint amount) { bool aboveMaxStack = false; int configAmount = (int)Config[item.info.displayName.english]; if (item.amount > configAmount) { aboveMaxStack = true; } if (item.amount < UInt16.MaxValue) //Moving normal amount of items { return null; } if (amount + item.amount / UInt16.MaxValue == item.amount % UInt16.MaxValue) //Moving max stacks { ItemContainer itemContainer = inventory.FindContainer(container); if (itemContainer == null) { return true; } if (aboveMaxStack) { //Split Items (Config Amount) Item item2 = item.SplitItem(configAmount); if (!item2.MoveToContainer(itemContainer, slot, true)) { item.amount += item2.amount; item2.Remove(0f); } ItemManager.DoRemoves(); inventory.ServerUpdate(0f); return true; } item.MoveToContainer(itemContainer, slot, true); return true; } else if (amount + (item.amount / 2) / UInt16.MaxValue == (item.amount / 2) % UInt16.MaxValue + item.amount % 2) //Moving half stack { ItemContainer itemContainer = inventory.FindContainer(container); if (itemContainer == null) { return true; } if (aboveMaxStack) { //Split Items (Config Amount) (Copy paste from above) Item split = item.SplitItem(configAmount); if (!split.MoveToContainer(itemContainer, slot, true)) { item.amount += split.amount; split.Remove(0f); } ItemManager.DoRemoves(); inventory.ServerUpdate(0f); return true; } //Split Items (Half of stack) Item item2 = item.SplitItem(item.amount / 2); if (!item2.MoveToContainer(itemContainer, slot, true)) { item.amount += item2.amount; item2.Remove(0f); } ItemManager.DoRemoves(); inventory.ServerUpdate(0f); return true; } return null; }
Gyazo - 55d742f68a2b2252108b0a04c486b4e4.png
Perhaps just split stacks in half if item.amount > 10,000,000 or so.
It still needs a tiny bit of tweaking, as when splitting stacks in half it will round different each time.Attached Files:
Last edited by a moderator: Jun 29, 2017 -
-
-
-
Good day,
If I once the stack size has fixed and then restart the server this is reset -
upload config
reload plugin
But some things are meant to be set to 1 (items that cant be stacked) and that cant be changed -
Since the last update of rust, when I reset my server the plugin stops working and I have to uninstall it and reinstall it to work correctly
-
Canopy Sheep updated Stack Size Controller with a new update entry:
1.9.5
-
Edit: Double update, oops