I would like to check if a player is jumping. Is there something in the PlayerMoveEvent that i can use?
maybe PHP: public function onMove(PlayerMoveEvent $ev){ if(!$ev->getPlayer()->onGround){ //the player is jumping }} but maybe when a player fall it isn't on ground and it isn't jumping
PHP: public function onMove(PlayerMoveEvent $ev){ if ($ev->getFrom()->getY() === $ev->getTo()->getY()+1 and $ev->getPlayer()->getLevel()->getBlockIdAt($$ev->getFrom()->getFloorX(),$ev->getFrom()->getY(),$ev->getFrom()->getFloorZ())-1 !== 0){ //do something }}
Don't reply if you don't exactly know what you're doing. Pretty inconvenient. Why not: PHP: if($event->getFrom()->getY() < $event->getTo()->getY() and ($event->getPlayer()->getGamemode() !== 1) and $event->getPlayer()->getLevel()->getBlock($event->getPlayer()->getTo()->subtract(0, 1)) instanceof Air){ //code here}
What do you mean? For swimming theres isSwimming/isInsideOfWater i am pretty sure. Leave them alone ok? Atleast they try to help and they have nice ideas! Also your code also seems fine.
What if a small part of their body is in a water pillar and other parts in air? It would be difficult to detect. And what if they are just climbing up ladders? Or on a minecart that is moving upwards? There are many reasons for a player to move upwards.