diff --git a/src/API/BanAPI.php b/src/API/BanAPI.php index 5963f2efb..9a766c8ca 100644 --- a/src/API/BanAPI.php +++ b/src/API/BanAPI.php @@ -37,18 +37,17 @@ class BanAPI{ } public function init(){ - console("[INFO] Loading authentication lists..."); $this->whitelist = new Config(DATA_PATH."white-list.txt", CONFIG_LIST); $this->bannedIPs = new Config(DATA_PATH."banned-ips.txt", CONFIG_LIST); $this->banned = new Config(DATA_PATH."banned.txt", CONFIG_LIST); $this->ops = new Config(DATA_PATH."ops.txt", CONFIG_LIST); - $this->server->api->console->register("banip", "Manages IP Banning", array($this, "commandHandler")); - $this->server->api->console->register("ban", "Manages Bannning", array($this, "commandHandler")); - $this->server->api->console->register("kick", "Kicks a player", array($this, "commandHandler")); - $this->server->api->console->register("whitelist", "Manages White-listing", array($this, "commandHandler")); - $this->server->api->console->register("op", "Ops a player", array($this, "commandHandler")); - $this->server->api->console->register("deop", "De-ops a player", array($this, "commandHandler")); - $this->server->api->console->register("sudo", "Run a command as a player", array($this, "commandHandler")); + $this->server->api->console->register("banip", " [IP|player]", array($this, "commandHandler")); + $this->server->api->console->register("ban", " [username]", array($this, "commandHandler")); + $this->server->api->console->register("kick", " [reason ...]", array($this, "commandHandler")); + $this->server->api->console->register("whitelist", " [username]", array($this, "commandHandler")); + $this->server->api->console->register("op", "", array($this, "commandHandler")); + $this->server->api->console->register("deop", "", array($this, "commandHandler")); + $this->server->api->console->register("sudo", "", array($this, "commandHandler")); $this->server->api->console->alias("ban-ip", "banip add"); $this->server->api->console->alias("banlist", "ban list"); $this->server->api->console->alias("pardon", "ban remove"); @@ -147,7 +146,7 @@ class BanAPI{ break; case "kick": if(!isset($params[0])){ - $output .= "Usage: /kick [reason]\n"; + $output .= "Usage: /kick [reason ...]\n"; }else{ $name = strtolower(array_shift($params)); $player = $this->server->api->player->get($name); @@ -199,7 +198,7 @@ class BanAPI{ $this->server->api->setProperty("white-list", false); break; default: - $output .= "Usage: /whitelist [username]\n"; + $output .= "Usage: /whitelist [username]\n"; break; } break; @@ -232,7 +231,7 @@ class BanAPI{ $output .= "IP ban list: ".implode(", ", $this->bannedIPs->getAll(true))."\n"; break; default: - $output .= "Usage: /banip [IP | Player]\n"; + $output .= "Usage: /banip [IP|player]\n"; break; } break; @@ -270,7 +269,7 @@ class BanAPI{ $output .= "Ban list: ".implode(", ", $this->banned->getAll(true))."\n"; break; default: - $output .= "Usage: /ban [player]\n"; + $output .= "Usage: /ban [username]\n"; break; } break; diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 33c00b000..96a88e119 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -118,7 +118,7 @@ class BlockAPI{ public function init(){ $this->server->addHandler("block.update", array($this, "updateBlockRemote"), 1); - $this->server->api->console->register("give", "Give items to a player", array($this, "commandHandler")); + $this->server->api->console->register("give", " [amount]", array($this, "commandHandler")); } public function commandHandler($cmd, $params, $issuer, $alias){ @@ -126,7 +126,7 @@ class BlockAPI{ switch($cmd){ case "give": if(!isset($params[0]) or !isset($params[1])){ - $output .= "Usage: /give [amount] [damage]\n"; + $output .= "Usage: /give [amount]\n"; break; } $player = $this->server->api->player->get($params[0]); diff --git a/src/API/ChatAPI.php b/src/API/ChatAPI.php index 83582e3ae..d7bb3cde5 100644 --- a/src/API/ChatAPI.php +++ b/src/API/ChatAPI.php @@ -32,8 +32,8 @@ class ChatAPI{ } public function init(){ - $this->server->api->console->register("tell", "Sends a private message to a player", array($this, "commandHandler")); - $this->server->api->console->register("me", "Broadcast an action", array($this, "commandHandler")); + $this->server->api->console->register("tell", " ", array($this, "commandHandler")); + $this->server->api->console->register("me", "", array($this, "commandHandler")); $this->server->api->ban->cmdWhitelist("tell"); $this->server->api->ban->cmdWhitelist("me"); } @@ -85,7 +85,7 @@ class ChatAPI{ public function broadcast($message){ $this->send(false, $message); - console("[CHAT] ".$message); + console($message); } public function sendTo($owner, $text, $player){ diff --git a/src/API/ConsoleAPI.php b/src/API/ConsoleAPI.php index f9d011d9b..79639a2f9 100644 --- a/src/API/ConsoleAPI.php +++ b/src/API/ConsoleAPI.php @@ -39,13 +39,13 @@ class ConsoleAPI{ $this->event = $this->server->event("server.tick", array($this, "handle")); $this->loop = new ConsoleLoop; $this->loop->start(); - $this->register("help", "Show available commands", array($this, "defaultCommands")); - $this->register("status", "Show server TPS and memory usage", array($this, "defaultCommands")); - $this->register("difficulty", "Changes server difficulty", array($this, "defaultCommands")); - $this->register("invisible", "Changes server visibility", array($this, "defaultCommands")); - $this->register("say", "Broadcast a message", array($this, "defaultCommands")); - $this->register("save-all", "Save pending changes to disk", array($this, "defaultCommands")); - $this->register("stop", "Stops the server gracefully", array($this, "defaultCommands")); + $this->register("help", "[page|command name]", array($this, "defaultCommands")); + $this->register("status", "", array($this, "defaultCommands")); + $this->register("difficulty", "<0|1>", array($this, "defaultCommands")); + $this->register("invisible", "", array($this, "defaultCommands")); + $this->register("say", "", array($this, "defaultCommands")); + $this->register("save-all", "", array($this, "defaultCommands")); + $this->register("stop", "", array($this, "defaultCommands")); $this->server->api->ban->cmdWhitelist("help"); } @@ -97,7 +97,7 @@ class ConsoleAPI{ case "difficulty": $s = trim(array_shift($params)); if($s == "" or (((int) $s) !== 0 and ((int) $s) !== 1)){ - $output .= "Usage: /difficulty <0 | 1>\n"; + $output .= "Usage: /difficulty <0|1>\n"; break; } $this->server->api->setProperty("difficulty", (int) $s); @@ -120,6 +120,13 @@ class ConsoleAPI{ break; } case "help": + if(isset($params[0]) and !is_numeric($params[0])){ + $c = trim(strtolower($params[0])); + if(isset($this->help[$c])){ + $output .= "Usage: /$c ".$this->help[$c]."\n"; + break; + } + } $max = ceil(count($this->help) / 5); $page = isset($params[0]) ? min($max - 1, max(0, intval($params[0]) - 1)):0; $output .= "- Showing help page ". ($page + 1) ." of $max (/help ) -\n"; @@ -127,7 +134,7 @@ class ConsoleAPI{ foreach($this->help as $c => $h){ $curpage = (int) ($current / 5); if($curpage === $page){ - $output .= "/$c: ".$h."\n"; + $output .= "/$c ".$h."\n"; }elseif($curpage > $page){ break; } @@ -167,7 +174,7 @@ class ConsoleAPI{ if($issuer instanceof Player){ console("[INFO] \"".$issuer->username."\" issued server command: $alias /$cmd ".implode(" ", $params)); }else{ - console("[INFO] Issued server command: $alias /$cmd ".implode(" ", $params)); + console("[INFO] Issued server command: ".ltrim("$alias ")."/$cmd ".implode(" ", $params)); } if($this->server->api->dhandle("console.command.".$cmd, array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false or $this->server->api->dhandle("console.command", array("cmd" => $cmd, "parameters" => $params, "issuer" => $issuer, "alias" => $alias)) === false){ diff --git a/src/API/PlayerAPI.php b/src/API/PlayerAPI.php index e569f220d..6918965cf 100644 --- a/src/API/PlayerAPI.php +++ b/src/API/PlayerAPI.php @@ -34,12 +34,12 @@ class PlayerAPI{ public function init(){ $this->server->addHandler("server.regeneration", array($this, "handle")); $this->server->addHandler("player.death", array($this, "handle"), 1); - $this->server->api->console->register("list", "Shows connected player list", array($this, "commandHandler")); - $this->server->api->console->register("kill", "Kills a player", array($this, "commandHandler")); - $this->server->api->console->register("gamemode", "Changes the player gamemode", array($this, "commandHandler")); - $this->server->api->console->register("tppos", "Teleports a player to a position", array($this, "commandHandler")); - $this->server->api->console->register("tp", "Teleports a player to another player", array($this, "commandHandler")); - $this->server->api->console->register("lag", "Measure your connection lag", array($this, "commandHandler")); + $this->server->api->console->register("list", "", array($this, "commandHandler")); + $this->server->api->console->register("kill", "", array($this, "commandHandler")); + $this->server->api->console->register("gamemode", " [player]", array($this, "commandHandler")); + $this->server->api->console->register("tppos", "[target player] ", array($this, "commandHandler")); + $this->server->api->console->register("tp", "[target player] ", array($this, "commandHandler")); + $this->server->api->console->register("lag", "", array($this, "commandHandler")); $this->server->api->console->alias("suicide", "kill"); $this->server->api->ban->cmdWhitelist("list"); $this->server->api->ban->cmdWhitelist("lag"); diff --git a/src/API/PluginAPI.php b/src/API/PluginAPI.php index d9d316011..73329401f 100644 --- a/src/API/PluginAPI.php +++ b/src/API/PluginAPI.php @@ -58,7 +58,7 @@ class PluginAPI extends stdClass{ $info = strstr($content, "*/", true); $content = substr(strstr($content, "*/"),2); if(preg_match_all('#([a-zA-Z0-9\-_]*)=([^\r\n]*)#u', $info, $matches) == 0){ //false or 0 matches - console("[ERROR] [PluginAPI] Failed parsing of ".basename($file)); + console("[ERROR] Failed parsing of ".basename($file)); return false; } $info = array(); @@ -82,28 +82,28 @@ class PluginAPI extends stdClass{ $info["class"] = trim(strtolower($info["class"])); } if(!isset($info["name"]) or !isset($info["version"]) or !isset($info["class"]) or !isset($info["author"])){ - console("[ERROR] [PluginAPI] Failed parsing of ".basename($file)); + console("[ERROR] Failed parsing of ".basename($file)); return false; } - console("[INFO] [PluginAPI] Loading plugin \"\x1b[32m".$info["name"]."\x1b[0m\" \x1b[35m".$info["version"]." \x1b[0mby \x1b[36m".$info["author"]."\x1b[0m"); + console("[INFO] Loading plugin \"\x1b[32m".$info["name"]."\x1b[0m\" \x1b[35m".$info["version"]." \x1b[0mby \x1b[36m".$info["author"]."\x1b[0m"); if(class_exists($info["class"])){ - console("[ERROR] [PluginAPI] Failed loading plugin: class exists"); + console("[ERROR] Failed loading plugin: class already exists"); return false; } if(eval($info["code"]) === false or !class_exists($info["class"])){ - console("[ERROR] [PluginAPI] Failed loading plugin: evaluation error"); + console("[ERROR] Failed loading plugin: evaluation error"); return false; } $className = $info["class"]; $apiversion = array_map("intval", explode(",", (string) $info["apiversion"])); if(!in_array((string) CURRENT_API_VERSION, $apiversion)){ - console("[WARNING] [PluginAPI] Plugin \"".$info["name"]."\" may not be compatible with the API (".$info["apiversion"]." != ".CURRENT_API_VERSION.")! It can crash or corrupt the server!"); + console("[WARNING] Plugin \"".$info["name"]."\" may not be compatible with the API (".$info["apiversion"]." != ".CURRENT_API_VERSION.")! It can crash or corrupt the server!"); } $object = new $className($this->server->api, false); if(!($object instanceof Plugin)){ - console("[ERROR] [PluginAPI] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" doesn't use the Plugin Interface"); + console("[ERROR] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" doesn't use the Plugin Interface"); if(method_exists($object, "__destruct")){ $object->__destruct(); } @@ -172,7 +172,6 @@ class PluginAPI extends stdClass{ } public function loadAll(){ - console("[INFO] Loading Plugins..."); $dir = dir(DATA_PATH."plugins/"); while(false !== ($file = $dir->read())){ if($file{0} !== "."){ @@ -185,6 +184,7 @@ class PluginAPI extends stdClass{ } public function initAll(){ + console("[INFO] Starting plugins..."); foreach($this->plugins as $p){ $p[0]->init(); //ARGHHH!!! Plugin loading randomly fails!! } diff --git a/src/API/ServerAPI.php b/src/API/ServerAPI.php index f24c815c5..9dfeb9623 100644 --- a/src/API/ServerAPI.php +++ b/src/API/ServerAPI.php @@ -52,8 +52,7 @@ class ServerAPI{ @mkdir(DATA_PATH."players/", 0755); @mkdir(DATA_PATH."worlds/", 0755); @mkdir(DATA_PATH."plugins/", 0755); - console("[INFO] Starting ServerAPI server handler..."); - file_put_contents(DATA_PATH."logs/packets.log", ""); + console("[INFO] \x1b[33;1mPocketMine-MP ".MAJOR_VERSION.", LGPL License", true, true, 0); if(!file_exists(DATA_PATH."logs/test.bin.log") or md5_file(DATA_PATH."logs/test.bin.log") !== TEST_MD5){ console("[NOTICE] Executing tests..."); console("[INFO] OS: ".PHP_OS.", ".Utils::getOS()); @@ -89,7 +88,7 @@ class ServerAPI{ } } - console("[DEBUG] Loading server.properties...", true, true, 2); + console("[INFO] Loading properties..."); $this->config = new Config(DATA_PATH . "server.properties", CONFIG_PROPERTIES, array( "server-name" => "Minecraft Server", "description" => "Server made using PocketMine-MP", @@ -213,8 +212,6 @@ class ServerAPI{ $this->loadProperties(); $this->server->loadMap(); - console("[INFO] Loading default APIs"); - $this->loadAPI("console", "ConsoleAPI"); $this->loadAPI("level", "LevelAPI"); $this->loadAPI("block", "BlockAPI"); @@ -254,7 +251,7 @@ class ServerAPI{ } public function sendUsage(){ - console("[INTERNAL] Sending usage data...", true, true, 3); + console("[DEBUG] Sending usage data...", true, true, 2); $plist = ""; foreach($this->plugin->getList() as $p){ $plist .= str_replace(array(";", ":"), "", $p["name"]).":".str_replace(array(";", ":"), "", $p["version"]).";"; @@ -289,7 +286,7 @@ class ServerAPI{ $value = array("M" => 1, "G" => 1024); $real = ((int) substr($memory, 0, -1)) * $value[substr($memory, -1)]; if($real < 128){ - console("[ERROR] PocketMine doesn't work right with less than 128MB of RAM", true, true, 0); + console("[WARNING] PocketMine-MP doesn't work right with less than 128MB of RAM", true, true, 0); } @ini_set("memory_limit", $memory); }else{ @@ -398,7 +395,7 @@ class ServerAPI{ if($level["LevelName"] == ""){ $level["LevelName"] = "world".time(); } - console("[DEBUG] Importing map \"".$level["LevelName"]."\" gamemode ".$level["GameType"]." with seed ".$level["RandomSeed"], true, true, 2); + console("[DEBUG] Importing level \"".$level["LevelName"]."\" gamemode ".$level["GameType"]." with seed ".$level["RandomSeed"], true, true, 2); unset($level["Player"]); $lvName = $level["LevelName"]."/"; @mkdir(DATA_PATH."worlds/".$lvName, 0755); @@ -428,7 +425,7 @@ class ServerAPI{ $this->server->spawn = array("x" => $level["SpawnX"], "y" => $level["SpawnY"], "z" => $level["SpawnZ"]); $this->writeProperties(); } - console("[INFO] Map \"".$level["LevelName"]."\" importing done!"); + console("[INFO] Level \"".$level["LevelName"]."\" importing done!"); unset($level, $entities, $nbt); return true; } @@ -510,7 +507,7 @@ class ServerAPI{ } $this->$name = new $class(); $this->apiList[] = $this->$name; - console("[".($internal === true ? "DEBUG":"INFO")."] API \x1b[36m".$name."\x1b[0m [\x1b[30;1m".$class."\x1b[0m] loaded", true, true, ($internal === true ? 2:1)); + console("[".($internal === true ? "INTERNAL":"DEBUG")."] API \x1b[36m".$name."\x1b[0m [\x1b[30;1m".$class."\x1b[0m] loaded", true, true, ($internal === true ? 2:1)); } } \ No newline at end of file diff --git a/src/API/TimeAPI.php b/src/API/TimeAPI.php index f877c56fa..1eaef1391 100644 --- a/src/API/TimeAPI.php +++ b/src/API/TimeAPI.php @@ -38,7 +38,7 @@ class TimeAPI{ } public function init(){ - $this->server->api->console->register("time", "Manages server time", array($this, "commandHandler")); + $this->server->api->console->register("time", " [time]", array($this, "commandHandler")); } public function commandHandler($cmd, $params, $issuer, $alias){ @@ -69,7 +69,7 @@ class TimeAPI{ $this->night(); break; default: - $output .= "Usage: /time [time]\n"; + $output .= "Usage: /time [time]\n"; break; } break; diff --git a/src/Player.php b/src/Player.php index 2a0265d92..38ddc50a4 100644 --- a/src/Player.php +++ b/src/Player.php @@ -766,7 +766,7 @@ class Player{ $this->server->api->entity->spawnToAll($this->eid); $this->server->schedule(5, array($this->entity, "update"), array(), true); $this->server->api->dhandle("player.armor", array("eid" => $this->eid, "slot0" => ($this->armor[0][0] > 0 ? ($this->armor[0][0] - 256):AIR), "slot1" => ($this->armor[1][0] > 0 ? ($this->armor[1][0] - 256):AIR), "slot2" => ($this->armor[2][0] > 0 ? ($this->armor[2][0] - 256):AIR), "slot3" => ($this->armor[3][0] > 0 ? ($this->armor[3][0] - 256):AIR))); - console("[INFO] \x1b[33m".$this->username."\x1b[0m logged in with entity id ".$this->eid." at (".round($this->entity->x, 2).", ".round($this->entity->y, 2).", ".round($this->entity->z, 2).")"); + console("[INFO] \x1b[33m".$this->username."\x1b[0m[/".$this->ip.":".$this->port."] logged in with entity id ".$this->eid." at (".round($this->entity->x, 2).", ".round($this->entity->y, 2).", ".round($this->entity->z, 2).")"); $this->eventHandler(new Container($this->server->motd), "server.chat"); if($this->MTU <= 548){ $this->eventHandler("Your connection is bad, you may experience lag and slow map loading.", "server.chat"); diff --git a/src/PocketMinecraftServer.php b/src/PocketMinecraftServer.php index 7e8cac814..24f519fe8 100644 --- a/src/PocketMinecraftServer.php +++ b/src/PocketMinecraftServer.php @@ -33,18 +33,15 @@ class PocketMinecraftServer{ private function load(){ $this->version = new VersionString(); @cli_set_process_title("PocketMine-MP ".MAJOR_VERSION); - console("[INFO] \x1b[33;1mPocketMine-MP ".MAJOR_VERSION." #".$this->version->getNumber()." by @shoghicp, LGPL License", true, true, 0); - console("[INFO] Target Minecraft PE: \x1b[36;1m".CURRENT_MINECRAFT_VERSION."\x1b[0m, protocol #".CURRENT_PROTOCOL, true, true, 0); if($this->version->isDev()){ console("[INFO] \x1b[31;1mThis is a Development version"); } - console("[INFO] Starting Minecraft PE Server at ".$this->serverip.":".$this->port); + console("[INFO] Starting \x1b[36;1m".CURRENT_MINECRAFT_VERSION."\x1b[0m #".CURRENT_PROTOCOL." Minecraft PE Server at ".$this->serverip.":".$this->port); if($this->port < 19132 or $this->port > 19135){ //Mojang =( console("[WARNING] You've selected a not-standard port. Normal port range is from 19132 to 19135 included"); } $this->serverID = $this->serverID === false ? Utils::readLong(Utils::getRandomBytes(8, false)):$this->serverID; $this->seed = $this->seed === false ? Utils::readInt(Utils::getRandomBytes(4, false)):$this->seed; - console("[INFO] Loading database..."); $this->startDatabase(); $this->api = false; $this->tCnt = 1; @@ -76,8 +73,6 @@ class PocketMinecraftServer{ $this->setType("normal"); $this->interface = new MinecraftInterface("255.255.255.255", $this->port, true, false); $this->reloadConfig(); - console("[INFO] Server Name: \x1b[36m".$this->name."\x1b[0m"); - console("[DEBUG] Server ID: ".$this->serverID, true, true, 2); $this->stop = false; } @@ -223,7 +218,6 @@ class PocketMinecraftServer{ $handlers = $this->preparedSQL->selectHandlers->execute(); $result = null; if($handlers !== false and $handlers !== true){ - console("[INTERNAL] Handling ".$event, true, true, 3); $call = array(); while(($hn = $handlers->fetchArray(SQLITE3_ASSOC)) !== false){ $call[(int) $hn["ID"]] = true; @@ -270,7 +264,6 @@ class PocketMinecraftServer{ console("[ERROR] Invalid world data for \"".$this->mapDir."\. Please import the world correctly"); $this->close("invalid world data"); } - console("[INFO] Map: ".$this->levelData["LevelName"]); $this->time = (int) $this->levelData["Time"]; $this->seed = (int) $this->levelData["RandomSeed"]; if(isset($this->levelData["SpawnX"])){ @@ -281,13 +274,7 @@ class PocketMinecraftServer{ $this->levelData["SpawnZ"] = $this->spawn["z"]; } $this->levelData["Time"] = $this->time; - console("[INFO] Spawn: X \x1b[36m".$this->levelData["SpawnX"]."\x1b[0m Y \x1b[36m".$this->levelData["SpawnY"]."\x1b[0m Z \x1b[36m".$this->levelData["SpawnZ"]."\x1b[0m"); - console("[INFO] Time: \x1b[36m".$this->time."\x1b[0m"); - console("[INFO] Seed: \x1b[36m".$this->seed."\x1b[0m"); - console("[INFO] Gamemode: \x1b[36m".$this->getGamemode()."\x1b[0m"); - $d = array(0 => "peaceful", 1 => "easy", 2 => "normal", 3 => "hard"); - console("[INFO] Difficulty: \x1b[36m".$d[$this->difficulty]."\x1b[0m"); - console("[INFO] Loading map..."); + console("[INFO] Preparing level \"".$this->levelData["LevelName"]."\""); $this->map = new ChunkParser(); if(!$this->map->loadFile($this->mapDir."chunks.dat")){ console("[ERROR] Couldn't load the map \"\x1b[32m".$this->levelData["LevelName"]."\x1b[0m\"!", true, true, 0); @@ -295,10 +282,6 @@ class PocketMinecraftServer{ }else{ $this->map->loadMap(); } - }else{ - console("[INFO] Time: \x1b[36m".$this->time."\x1b[0m"); - console("[INFO] Seed: \x1b[36m".$this->seed."\x1b[0m"); - console("[INFO] Gamemode: \x1b[36m".$this->getGamemode()."\x1b[0m"); } } @@ -315,7 +298,6 @@ class PocketMinecraftServer{ public function loadEntities(){ if($this->map !== false){ - console("[INFO] Loading entities..."); $entities = unserialize(file_get_contents($this->mapDir."entities.dat")); if($entities === false or !is_array($entities)){ console("[ERROR] Invalid world data for \"".$this->mapDir."\. Please import the world correctly"); @@ -364,7 +346,6 @@ class PocketMinecraftServer{ file_put_contents($this->mapDir."level.dat", serialize($this->levelData)); $this->map->saveMap($final); $this->trigger("server.save", $final); - console("[INFO] Saving entities..."); if(count($this->entities) > 0){ $entities = array(); foreach($this->entities as $entity){ @@ -440,7 +421,6 @@ class PocketMinecraftServer{ $this->loadMap(); $this->loadEntities(); } - console("[INFO] Loading events..."); $this->loadEvents(); declare(ticks=40); register_tick_function(array($this, "tick")); @@ -451,8 +431,9 @@ class PocketMinecraftServer{ pcntl_signal(SIGINT, array($this, "close")); pcntl_signal(SIGHUP, array($this, "close")); } + console("[INFO] Default game type: ".strtoupper($this->getGamemode())); $this->trigger("server.start", microtime(true)); - console("[INFO] Server started!"); + console('[INFO] Done ('.round(microtime(true) - START_TIME, 3).'s)! For help, type "help" or "?"'); $this->process(); } @@ -627,7 +608,6 @@ class PocketMinecraftServer{ public function action($microseconds, $code, $repeat = true){ $this->query("INSERT INTO actions (interval, last, code, repeat) VALUES(".($microseconds / 1000000).", ".microtime(true).", '".base64_encode($code)."', ".($repeat === true ? 1:0).");"); - console("[INTERNAL] Attached to action ".$microseconds, true, true, 3); } public function tickerFunction($time){ diff --git a/src/config.php b/src/config.php index 472f0bfab..bf51384f5 100644 --- a/src/config.php +++ b/src/config.php @@ -41,6 +41,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH); ini_set("memory_limit", "256M"); //Default define("LOG", true); +define("START_TIME", microtime(true)); define("TEST_MD5", "1e0d28177b73dfd09f922502fe767bec"); define("MAJOR_VERSION", "Alpha_1.3dev"); define("CURRENT_STRUCTURE", 5);