The bug
Effects applied with a duration longer than 107374182 seconds simply fail for no reason. This is probably because translating it to ticks ends up just below the integer size limit, and an increase of one overflows and makes the value negative.
How to reproduce
/effect @a speed 107374182
→ ✔ It works/effect @a clear
/effect @a speed 107374183
→ ❌ FOV briefly changes but the effect is not applied
Expected behavior
Maximum effect duration should probably be 1000000 per Java Edition. But regardless of the chosen limit, all legal values should function properly.
Comments 4
It seems that it has to do with the maximum amount of an Int32.
but for gameticks instead of seconds. So calculated back from that the maximum amount of seconds is: 107,374,182 you can fill in and have it work.
Any more and there will be a overflow in calculations.
Fun fact: if you gives yourself /effect @s night_vision 214748366 0
it results in an overflow that only provides 24 gameticks of night vision.
I suggest either giving a message back that the maximum filled in time cannot be bigger than 107,374,182, or increase the integer for effects and duration to Int64.
Ah, thank you! I did not consider that large enough numbers would wrap around to legal values again. I'll update the report
It seems that it has to do with the maximum amount of an Int32.
but for gameticks instead of seconds. So calculated back from that the maximum amount of seconds is: 107,374,182 you can fill in and have it work.
Any more and there will be a overflow in calculations.
Fun fact: if you gives yourself /effect @s night_vision 214748366 0
it results in an overflow that only provides 24 gameticks of night vision.
I suggest either giving a message back that the maximum filled in time cannot be bigger than 107,374,182, or increase the integer for effects and duration to Int64.