brokiem/SimplePets

Mysterycrate crash with particles and world change with Pets

MrBlasyMSK opened this issue · 4 comments

Describe the bug
If a player tries to teleport to another world and has a pet, the server will internal and restart

To Reproduce
Steps to reproduce the behavior:

  1. Add a pet to yourself
  2. Go to another world
  3. Crash

Expected behavior
That the pets endure the change of world and follow the player

Screenshots
If applicable, add screenshots to help explain your problem.

SimplePets plugin information

  • Version: 1.0.1-beta
  • Server api: I don't know, it's the latest version of pocketmine and I have php 7.4

Additional context

23:52:03] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\Server::pocketmine\{closure}() must be an instance of pocketmine\Player, instance of brokiem\simplepets\pets\CatPet given" (EXCEPTION) in "pmsrc/src/pocketmine/Server" at line 1723
[23:52:03] [Server thread/CRITICAL]: #0 (): pocketmine\Server->pocketmine\{closure}(object brokiem\simplepets\pets\CatPet)
[23:52:03] [Server thread/CRITICAL]: #1 pmsrc/src/pocketmine/Server(1723): array_filter(array[1], object Closure)
[23:52:03] [Server thread/CRITICAL]: #2 pmsrc/src/pocketmine/level/Level(538): pocketmine\Server->batchPackets(array[1], array[1], boolean )
[23:52:03] [Server thread/CRITICAL]: #3 plugins/MysteryCrate.phar/src/JackMD/MysteryCrate/EventListener(239): pocketmine\level\Level->addParticle(object pocketmine\level\particle\FloatingTextParticle, array[1])
[23:52:03] [Server thread/CRITICAL]: #4 pmsrc/src/pocketmine/plugin/MethodEventExecutor(42): JackMD\MysteryCrate\EventListener->onLevelChange(object pocketmine\event\entity\EntityLevelChangeEvent)
[23:52:03] [Server thread/CRITICAL]: #5 pmsrc/src/pocketmine/plugin/RegisteredListener(80): pocketmine\plugin\MethodEventExecutor->execute(object JackMD\MysteryCrate\EventListener, object pocketmine\event\entity\EntityLevelChangeEvent)
[23:52:03] [Server thread/CRITICAL]: #6 pmsrc/src/pocketmine/event/Event(88): pocketmine\plugin\RegisteredListener->callEvent(object pocketmine\event\entity\EntityLevelChangeEvent)
[23:52:03] [Server thread/CRITICAL]: #7 pmsrc/src/pocketmine/entity/Entity(1904): pocketmine\event\Event->call()
[23:52:03] [Server thread/CRITICAL]: #8 pmsrc/src/pocketmine/entity/Entity(1769): pocketmine\entity\Entity->switchLevel(object pocketmine\level\Level)
[23:52:03] [Server thread/CRITICAL]: #9 pmsrc/src/pocketmine/entity/Entity(1794): pocketmine\entity\Entity->setPosition(object pocketmine\level\Position)
[23:52:03] [Server thread/CRITICAL]: #10 pmsrc/src/pocketmine/entity/Entity(1885): pocketmine\entity\Entity->setPositionAndRotation(object pocketmine\level\Position, double 145.8123900474, double -1.5042436028662)
[23:52:03] [Server thread/CRITICAL]: #11 plugins/SimplePets_dev-79.phar/src/brokiem/simplepets/pets/base/BasePet(335): pocketmine\entity\Entity->teleport(object pocketmine\level\Position)
[23:52:03] [Server thread/CRITICAL]: #12 pmsrc/src/pocketmine/entity/Entity(1393): brokiem\simplepets\pets\base\BasePet->entityBaseTick(integer 1)
[23:52:03] [Server thread/CRITICAL]: #13 pmsrc/src/pocketmine/level/Level(854): pocketmine\entity\Entity->onUpdate(integer 18940)
[23:52:03] [Server thread/CRITICAL]: #14 pmsrc/src/pocketmine/level/Level(787): pocketmine\level\Level->actuallyDoTick(integer 18940)
[23:52:03] [Server thread/CRITICAL]: #15 pmsrc/src/pocketmine/Server(2265): pocketmine\level\Level->doTick(integer 18940)
[23:52:03] [Server thread/CRITICAL]: #16 pmsrc/src/pocketmine/Server(2396): pocketmine\Server->checkTickUpdates(integer 18940, double 1628639523.1728)
[23:52:03] [Server thread/CRITICAL]: #17 pmsrc/src/pocketmine/Server(2152): pocketmine\Server->tick()
[23:52:03] [Server thread/CRITICAL]: #18 pmsrc/src/pocketmine/Server(1992): pocketmine\Server->tickProcessor()
[23:52:03] [Server thread/CRITICAL]: #19 pmsrc/src/pocketmine/Server(1586): pocketmine\Server->start()
[23:52:03] [Server thread/CRITICAL]: #20 pmsrc/src/pocketmine/PocketMine(311): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[16] /home/container/, string[24] /home/container/plugins/)
[23:52:03] [Server thread/CRITICAL]: #21 pmsrc/src/pocketmine/PocketMine(341): pocketmine\server()
[23:52:03] [Server thread/CRITICAL]: #22 pmsrc(11): require(string[71] phar:///home/container/PocketMine-MP.phar/src/pocketmine/PocketMine.php)

Apparently it is an error with MysteryCrate, if you remove the plugin it works correctly

I do not know if it can be fixed in any way, close the issue if you think necessary

@brokiem

It gives an error with the Mysterycrate particle option

showParticle: false

If you have this option like this, it works correctly

I rectify, I have been tested and it crashes within seconds of moving in another world

Error occur on this line https://github.com/ifera-mc/MysteryCrate/blob/master/src/JackMD/MysteryCrate/EventListener.php#L239
because the author didn't check the entity instanceof Player and the plugin is archived, please don't use that plugin