Hello, I'm having problems with my server, when players change the world, as the chunk is not loaded they are getting stuck underground. I believe if I cancel the PlayerMoveEvent when the chunk is not loaded for them I will not continue with this problem, however I have no idea how to do this.
What you could do is make it so on EntityLevelChangeEvent you add a delayed task which stops player movement for a few ticks
what you could do is this PHP: public function onLevelChange(EntityLevelChangeEvent $event) {$player = $event->getEntity();if($entity instanceof Player) { $time = 4; //ticks if(!isset($this->coodown[$player->getName()])){ $this->cooldown[$player->getName()] = time() + $time; }}}public function onMove(PlayerMoveEvent $event) { if(time() < $this->coodown[$player->getName()]){ $event->setCancelled(); }else{ unset($this->cooldown[$player>getName()]); }}