I 've worked with the PlayerRespawnEvent and Effect. When all right it then must the player got the effect when he Respawn. I've the Events registered and i 've importedpocketmine\entity\Effect. But it dosen't work , it comes no errors. Here is my Code: PHP: public function onRespawn(\pocketmine\event\player\PlayerRespawnEvent $event) { $player = $event->getPlayer(); $effect = Effect::getEffect(Effect::JUMP); $effect->setAmplifier(4); $effect->setDuration(23333*10); $player->addEffect($effect);
This is a large misconception, and I wish it was a bit more clear. You do not need a use statement for a class that you won't need for static methods or for constructing an instance of that class, or when extending/implementing. If you have an object, you do not need to use the class for its methods. There may be some exceptions I don't know about, but I do know, that in this particular case, "use pocketmine\player" is not necessary.
What he might have done somewhere else in his plugin is not relevant to this thread. I did some digging, and the event is called here. If you look, right after the event is called, code is run that clears the players inventory, effects, etc. This makes your code cancel almost immediately. I suggest adding a delay to your code, or adding the effect on another event.