How can i remove splash potion effects? Example, i throwed jump boost potion, and its give jump effect. How can i cancel this?
See how PocketMine's internal /effect clear command does it: https://github.com/pmmp/PocketMine-...ne/command/defaults/EffectCommand.php#L59-L67
You would to cache the latest splash entities that died into an array/splqueue and save the affected players in a range to the potion, and then later remove the players effects based on the cached potions' effects
The safest method would be by listening to ProjectileHitEvent. During the event, set the projectile's potion ID to 0. PHP: public function onProjectileHit(ProjectileHitEvent $event){ $projectile = $event->getEntity(); if($projectile instanceof SplashPotion){ //check here if $projectile->getPotionId() is LEAPING, LONG_LEAPING or STRONG_LEAPING? $projectile->setPotionId(Potion::WATER); }}
I'd better use the EntityDeathEvent, because splash potions may break on the ground next to the player
There is a ProjectileHitBlockEvent and ProjectileHitEntityEvent which extend ProjectileHitEvent, so ProjectileHitEvent should cover that case. IIRC, entities don't die (anymore?) in cases where they're supposed to despawn.