private function networkFunctions() { $config = new Config(\pocketmine\DATA . "server.properties", Config::PROPERTIES); echo "[!] " . $this->lang->query_warning1 . "\n"; echo "[!] " . $this->lang->query_warning2 . "\n"; echo "[?] " . $this->lang->query_disable . " (y/N): "; if (strtolower($this->getInput("n")) === "y") { $config->set("enable-query", false); } else { $config->set("enable-query", true); } echo "[*] " . $this->lang->rcon_info . "\n"; echo "[?] " . $this->lang->rcon_enable . " (y/N): "; if (strtolower($this->getInput("n")) === "y") { $config->set("enable-rcon", true); $password = substr(base64_encode(@Utils::getRandomBytes(20, false)), 3, 10); $config->set("rcon.password", $password); echo "[*] " . $this->lang->rcon_password . ": " . $password . "\n"; } else { $config->set("enable-rcon", false); } /*echo "[*] " . $this->lang->usage_info . "\n"; echo "[?] " . $this->lang->usage_disable . " (y/N): "; if(strtolower($this->getInput("n")) === "y"){ $config->set("send-usage", false); }else{ $config->set("send-usage", true); }*/ $config->save(); echo "[*] " . $this->lang->ip_get . "\n"; $externalIP = Utils::getIP(); $internalIP = gethostbyname(trim(`hostname`)); echo "[!] " . $this->lang->get("ip_warning", ["{{EXTERNAL_IP}}", "{{INTERNAL_IP}}"], [$externalIP, $internalIP]) . "\n"; echo "[!] " . $this->lang->ip_confirm; $this->getInput(); }
public function onDisable() { foreach ($this->getServer()->getOnlinePlayers() as $player) { $this->sessions->onPlayerDisconnect(new PlayerQuitEvent($player, "Server stop")); } $this->teamMgr->saveTeams(); $this->mysqli->close(); $url = $this->pasteTimings(); $mem = memory_get_usage(true) / 1048576 . "MB"; $msg = $this->getDescription()->getFullName() . " has been disabled at " . Utils::getIP() . ":{$this->getServer()->getPort()} with peak memory reaching {$mem}. "; $msg .= "The process ID is " . getmypid() . ". "; $dateTime = (new \DateTime())->setTimestamp($this->timestamp); $msg .= "The plugin was built on " . $dateTime->format("jS F, Y \\a\\t H:i:s (T, \\G\\M\\T P). "); $msg .= "Timings has been pasted to {$url}."; if (!IS_TEST) { Utils::getURL(self::IRC_WEBHOOK . urlencode($msg), 2); } $this->getLogger()->info($msg); }