When i use Sleep() in my Plugin, the whole server "sleeps". How can i fix that? Here is my Code. PHP: <?phpnamespace derdumme\info;use pocketmine\plugin\PluginBase;use pocketmine\event\Listener;use pocketmine\utils\TextFormat;use pocketmine\event\player\PlayerJoinEvent;class info extends PluginBase implements Listener { public function onEnable() { $this->getLogger()->info(TextFormat::GREEN."wurde aktiviert."); $this->getServer()->getPluginManager()->registerEvents($this, $this); } public function onDisable() { $this->getLogger()->info(TextFormat::RED."wurde deaktiviert."); } public function onJoin(PlayerJoinEvent $event){ while(true) { $message = random_int(1, 5); if($message == 1){ $event->getPlayer()->sendPopup(TextFormat::GREEN."Teamspeak-Server: ts.skyzonemc.net"); } elseif ($message == 2) { $event->getPlayer()->sendPopup(TextFormat::GOLD."Website: SkyZoneMC.net"); } elseif ($message == 3) { $event->getPlayer()->sendTip("This is a Tip"); } sleep(60); } } }
Well, what do you even want to do? (I don't see a reason for the while and the sleep) Also, please post this on the new forums.