diff --git a/src/pocketmine/network/mcpe/RakLibInterface.php b/src/pocketmine/network/mcpe/RakLibInterface.php index 722947b1d..6936a55ce 100644 --- a/src/pocketmine/network/mcpe/RakLibInterface.php +++ b/src/pocketmine/network/mcpe/RakLibInterface.php @@ -70,10 +70,6 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{ $this->server = $server; $this->sleeper = new SleeperNotifier(); - $server->getTickSleeper()->addNotifier($this->sleeper, function() : void{ - //this should not throw any exception. If it does, this should crash the server since it's a fault condition. - while($this->interface->handlePacket()); - }); $this->rakLib = new RakLibServer( $this->server->getLogger(), @@ -87,6 +83,10 @@ class RakLibInterface implements ServerInstance, AdvancedNetworkInterface{ } public function start() : void{ + $this->server->getTickSleeper()->addNotifier($this->sleeper, function() : void{ + //this should not throw any exception. If it does, this should crash the server since it's a fault condition. + while($this->interface->handlePacket()); + }); $this->rakLib->start(PTHREADS_INHERIT_CONSTANTS); //HACK: MainLogger needs constants for exception logging }