DaPigGuy / PiggyCustomEnchants

An open source custom enchantment plugin for PocketMine-MP
https://piggydocs.aericio.net/PiggyCustomEnchants.html
Apache License 2.0
103 stars 118 forks source link

InvalidArgumentException #283

Closed ZaXtha closed 4 years ago

ZaXtha commented 4 years ago
PocketMine-MP Crash Dump Thu Apr 9 17:21:10 UTC 2020

Error: Maximum -4 is less than the minimum 0
File: src/pocketmine/entity/Attribute
Line: 153
Type: InvalidArgumentException

A PLUGIN WAS INVOLVED IN THIS CRASH
BAD PLUGIN: PiggyCustomEnchants v2.1.3

Code:
[144]   public function getMaxValue() : float{
[145]       return $this->maxValue;
[146]   }
[147] 
[148]   /**
[149]    * @return $this
[150]    */
[151]   public function setMaxValue(float $maxValue){
[152]       if($maxValue < ($min = $this->getMinValue())){
[153]           throw new \InvalidArgumentException("Maximum $maxValue is less than the minimum $min");
[154]       }
[155] 
[156]       if($this->maxValue != $maxValue){
[157]           $this->desynchronized = true;
[158]           $this->maxValue = $maxValue;
[159]       }
[160]       return $this;
[161]   }
[162] 
[163]   public function getDefaultValue() : float{

Backtrace:
#0 src/pocketmine/entity/Living(158): pocketmine\entity\Attribute->setMaxValue(double -4)
#1 plugins/PiggyCustomEnchants.phar/src/DaPigGuy/PiggyCustomEnchants/enchants/armor/OverloadEnchant(27): pocketmine\entity\Living->setMaxHealth(integer -4)
#2 plugins/PiggyCustomEnchants.phar/src/DaPigGuy/PiggyCustomEnchants/enchants/traits/ToggleTrait(43): DaPigGuy\PiggyCustomEnchants\enchants\armor\OverloadEnchant->toggle(object pocketmine\Player, object pocketmine\item\DiamondBoots, object pocketmine\inventory\ArmorInventory, integer 3, integer 3, boolean )
#3 plugins/PiggyCustomEnchants.phar/src/DaPigGuy/PiggyCustomEnchants/enchants/traits/ToggleTrait(83): DaPigGuy\PiggyCustomEnchants\enchants\ToggleableEnchantment->onToggle(object pocketmine\Player, object pocketmine\item\DiamondBoots, object pocketmine\inventory\ArmorInventory, integer 3, integer 3, boolean )
#4 plugins/PiggyCustomEnchants.phar/src/DaPigGuy/PiggyCustomEnchants/EventListener(307): DaPigGuy\PiggyCustomEnchants\enchants\ToggleableEnchantment::attemptToggle(object pocketmine\Player, object pocketmine\item\DiamondBoots, object pocketmine\item\enchantment\EnchantmentInstance, object pocketmine\inventory\ArmorInventory, integer 3, boolean )
#5 src/pocketmine/plugin/MethodEventExecutor(42): DaPigGuy\PiggyCustomEnchants\EventListener->onQuit(object pocketmine\event\player\PlayerQuitEvent)
#6 src/pocketmine/plugin/RegisteredListener(80): pocketmine\plugin\MethodEventExecutor->execute(object DaPigGuy\PiggyCustomEnchants\EventListener, object pocketmine\event\player\PlayerQuitEvent)
#7 src/pocketmine/event/Event(88): pocketmine\plugin\RegisteredListener->callEvent(object pocketmine\event\player\PlayerQuitEvent)
#8 src/pocketmine/Player(3455): pocketmine\event\Event->call()
#9 src/pocketmine/network/mcpe/RakLibInterface(176): pocketmine\Player->close(object pocketmine\lang\TranslationContainer, string[21] Internal server error)
#10 vendor/pocketmine/raklib/src/server/ServerHandler(99): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string[20] 120.188.86.157 18621, object raklib\protocol\EncapsulatedPacket, integer 0)
#11 src/pocketmine/network/mcpe/RakLibInterface(109): raklib\server\ServerHandler->handlePacket()
#12 src/pocketmine/network/mcpe/RakLibInterface(99): pocketmine\network\mcpe\RakLibInterface->process()
#13 vendor/pocketmine/snooze/src/SleeperHandler(123): pocketmine\network\mcpe\RakLibInterface->pocketmine\network\mcpe\{closure}()
#14 vendor/pocketmine/snooze/src/SleeperHandler(85): pocketmine\snooze\SleeperHandler->processNotifications()
#15 src/pocketmine/Server(2146): pocketmine\snooze\SleeperHandler->sleepUntil(double 1586452870.432)
#16 src/pocketmine/Server(1990): pocketmine\Server->tickProcessor()
#17 src/pocketmine/Server(1584): pocketmine\Server->start()
#18 src/pocketmine/PocketMine(273): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[11] /root/pmmp/, string[19] /root/pmmp/plugins/)
#19 src/pocketmine/PocketMine(296): pocketmine\server()
#20 (11): require(string[66] phar:///root/pmmp/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

PocketMine-MP version: 3.11.6 [Protocol 389]
Git commit: cb9e79b3985719671bd5cbaa7f665b04a6d33359-dirty
uname -a: Linux Shosting 4.15.0-1063-aws #67-Ubuntu SMP Mon Mar 2 07:24:29 UTC 2020 x86_64
PHP Version: 7.3.14
Zend version: 3.3.14
OS : Linux, linux
DaPigGuy commented 4 years ago

Any idea how to reproduce the crash?

ZaXtha commented 4 years ago

Any idea how to reproduce the crash?

Sorry, I do not know

DaPigGuy commented 4 years ago

Are you using the /reload command?

ZaXtha commented 4 years ago

I never use command /reload , This happened suddenly

On Tue, Apr 14, 2020, 09:02 DaPigGuy notifications@github.com wrote:

Are you using the /reload command?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DaPigGuy/PiggyCustomEnchants/issues/283#issuecomment-613185093, or unsubscribe https://github.com/notifications/unsubscribe-auth/AONHMB3EQLVJUVAWQJMP4V3RMO74VANCNFSM4MHLYV2A .

ZaXtha commented 4 years ago

please my server is still having trouble

notacoderr commented 4 years ago

image

Might help you figuring out Overload bug.

the output is always negative.

notacoderr commented 4 years ago

I just changed the $player->setHealth() method. You might confuse it with the setMaxHealth()

Aericio commented 4 years ago

We were unable to reproduce the issue. Please try to provide more information next time if this issue persists.

Aericio commented 4 years ago

We were able to reproduce this issue on an Ubuntu system. Tue_Apr_21-14.11.10-HST_2020.log