Войти или зарегистрироваться
  • Вы находитесь в сообществе Rubukkit. Мы - администраторы серверов Minecraft, разрабатываем собственные плагины и переводим на различные языки плагины наших коллег из других стран.
  • Данный раздел создан исключительно для релизов! Вопросы по лаунчеру или обвязке задавайте ТОЛЬКО в соответсвующей теме автора. Любые другие темы будут удалены, а авторы понесут наказание.

Фикс Мониторинг работающий под новым Spigot и MCPC+ 1.5.x

Здарова! Куда пропал? мне моники новые нужны =)
подкинь пару идей дизайна

http://demo.mymine.su/mon/19/
пока что улучшаю классы и скрипты

PHP:
<?php /*    modificated by book777 */
class socketMON {
    private $socket, $info;
    public $online, $motd, $onlplayers, $maxplayers, $proc, $ip, $port, $error;
    public function __construct($ip, $port = '25565') {
        if($this->socket = @stream_socket_client('tcp://'.$ip.':'.$port, $errno, $errstr, 1)) {
            $this->online = true;
            fwrite($this->socket, "\xfe");
            $handle = fread($this->socket, 256);
            $handle = str_replace("\x00", '', $handle);
            $handle = substr($handle, 2);
            $this->info = explode("\xa7", $handle);
            unset($handle);
            fclose($this->socket);
            if(sizeof($this->info) == 3) {
                $this->motd = $this->info[0];
                $this->onlplayers = $this->info[1];
                $this->maxplayers = $this->info[2];
                $this->proc=@ceil(($this->onlplayers/$this->maxplayers)*100);
                $this->error = false;
            } else if(sizeof($this->info) > 3) {
                unset($temp);
                for($i = 0; $i < sizeof($this->info) - 2; $i++) {
                    $temp .= ($i > 0 ? 'В§' : '').$this->info[$i];
                }
                $this->motd = $temp;
                $this->onlplayers = (int)$this->info[sizeof($this->info) - 2];
                $this->maxplayers = (int)$this->info[sizeof($this->info) - 1];
                $this->error = 'Цветной motd';
                $this->proc=@ceil(($this->onlplayers/$this->maxplayers)*100);
            } else {
                $this->failed();
                $this->error = 'Странное ядро сервера';
            }
        } else {
            $this->online = false;
            $this->failed();
            $this->error = 'Сервер недоступен';
        }
    }
    private function failed() {
        $this->motd = false;
        $this->onlplayers = false;
        $this->maxplayers = false;
    }
}
 
Последнее редактирование:

Поделиться этой страницей

Назад
Верх