ERROR: Code: [Server thread/CRITICAL]: Could not tick level "world": Effect duration must be in range of 0 - 2147483647 [23:23:18] [Server thread/CRITICAL]: InvalidArgumentException: "Effect duration must be in range of 0 - 2147483647" (EXCEPTION) in "src/pocketmine/entity/Effect" at line 183 code: PHP: $haste = Effect::getEffect(Effect::HASTE)->setDuration(1*20)->setAmplifier(9)->setVisible (false); why do i get such error when my duration is above 0?
You keep posting one or two lines without any context or information about your setup, and hoping for answers... the above code works fine, so at a guess I'd say the code you posted isn't the line causing the error?
So what was the problem? You are supposed to post the answer even if you solve it yourself, so that other people can learn from your mistake.
Not really show how I fixed it but, here's my code: it stopped giving error PHP: $item = $event->getPlayer()->getInventory()->getItemInHand()->getId(); $itemName = $event->getPlayer()->getInventory()->getItemInHand()->getName(); if ($item == 278) { if($itemName == "§i§cPickaxe") { $haste = Effect::getEffect(Effect::HASTE)->setDuration(1 * 20)->setAmplifier(9)->setVisible (false); $event->getPlayer()->addEffect($haste); } }