Closed Maxopoly closed 4 years ago
Just added a method that might help solve this issue. I don't think the server handles zero (or less) item amounts very well. Indeed I was worried about this when I rewrote OldEnchanting. The method I've added is in this pull request, meaning that would be able to do:
playerInventory.setItemInMainHand(ItemAPI.decrementItem(held))
and the item will automatically be removed should the amount run out, though this is only useful if you know where the item is. However, there's already a way to remove a singular item from an inventory without necessarily needing to know where it is:
ItemStack removing = item.clone();
removing.setAmount(1);
InventoryAPI.safelyRemoveItemsFromInventory(inventory, new ItemStack[] { removing });
It's a bit.. wordy.. and maybe this can be cleaned up, specifically with normalising the remove item and not requiring an array to be made, but it's possible.
The former use case of decrementing held items would likely be used for /ctr
while the latter method used for /ctf
This is still happening
Again caused by
[11:03:13 INFO]: [Citadel] Player created reinforcement with Stone for STONE at Location{world=CraftWorld{name=world},x=X.0,y=X.0,z=X.0,pitch=0.0,yaw=0.0}
[11:03:13 INFO]: [Citadel] Sent Player reply Reinforced at 100% (50/50) health with Stone on Group 0% mature 4 min 59 sec
Not very helpful issue here: https://hub.spigotmc.org/jira/browse/SPIGOT-3020 Not prevented by newer paper versions: https://github.com/PaperMC/Paper/issues/3904
Dan brought up that it may be caused by double interacts, which sounds solid. Possible solution could be using CMCs DoubleInteractFixer at LOWEST prio on any PlayerInteractEvent during the same tick for the same block. This might have some unintended side effects, but still seems like a preferable solution.
Should be finally fixed by https://github.com/CivClassic/Citadel/commit/00a4bfd34beef63c9119bd23f15267e1775da8e3
Unfortunately this issue seems to have made a resurgence in 2022; I am getting these crashes when running a vanilla MC /item modify command to decrease the item count by 1 (resulting in a 0 count).
crash-2022-09-04_01.12.00-server.txt crash-2022-09-04_01.48.19-server.txt
Hi @crux-f
Are you using the latest version of Citadel here?
I suspect creating a reinforcement with only 1 reinforcement item (which you are placing) kills the server,