mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 23:37:45 +00:00
ANSI Color codes
This commit is contained in:
@@ -193,7 +193,7 @@ class PlayerAPI{
|
||||
public function add($CID){
|
||||
if(isset($this->server->clients[$CID])){
|
||||
$player = $this->server->clients[$CID];
|
||||
console("[INFO] Player \"".$player->username."\" connected from ".$player->ip.":".$player->port);
|
||||
console("[INFO] Player \"\x1b[33m".$player->username."\x1b[0m\" connected from \x1b[36m".$player->ip.":".$player->port."\x1b[0m");
|
||||
$player->data = $this->getOffline($player->username);
|
||||
$this->server->query("INSERT OR REPLACE INTO players (clientID, ip, port, name) VALUES (".$player->clientID.", '".$player->ip."', ".$player->port.", '".$player->username."');");
|
||||
}
|
||||
|
@@ -76,7 +76,7 @@ class PluginAPI extends stdClass{
|
||||
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("[INFO] [PluginAPI] Loading plugin \"".$info["name"]."\" ".$info["version"]." by ".$info["author"]);
|
||||
console("[INFO] [PluginAPI] Loading plugin \"\x1b[32m".$info["name"]."\x1b[0m\" \x1b[35m".$info["version"]."\x1b[0m by \x1b[36m".$info["author"]."\x1b[0m");
|
||||
if(class_exists($info["class"])){
|
||||
console("[ERROR] [PluginAPI] Failed loading plugin: class exists");
|
||||
}
|
||||
@@ -85,11 +85,11 @@ class PluginAPI extends stdClass{
|
||||
}
|
||||
$className = trim($info["class"]);
|
||||
if(isset($info["api"]) and $info["api"] !== true){
|
||||
console("[NOTICE] [PluginAPI] Plugin \"".$info["name"]."\" got raw access to Server methods");
|
||||
console("[NOTICE] [PluginAPI] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" got raw access to Server methods");
|
||||
}
|
||||
$object = new $className($this->server->api, ((isset($info["api"]) and $info["api"] !== true) ? $this->server:false));
|
||||
if(!($object instanceof Plugin)){
|
||||
console("[ERROR] [PluginAPI] Plugin \"".$info["name"]."\" doesn't use the Plugin Interface");
|
||||
console("[ERROR] [PluginAPI] Plugin \"\x1b[36m".$info["name"]."\x1b[0m\" doesn't use the Plugin Interface");
|
||||
if(method_exists($object, "__destruct")){
|
||||
$object->__destruct();
|
||||
}
|
||||
@@ -149,7 +149,8 @@ class PluginAPI extends stdClass{
|
||||
}
|
||||
|
||||
public function init(){
|
||||
$this->server->event("server.start", array($this, "loadAll"));
|
||||
$this->server->event("server.start", array($this, "initAll"));
|
||||
$this->loadAll();
|
||||
}
|
||||
|
||||
public function loadAll(){
|
||||
@@ -162,6 +163,9 @@ class PluginAPI extends stdClass{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function initAll(){
|
||||
foreach($this->plugins as $p){
|
||||
$p[0]->init(); //ARGHHH!!! Plugin loading randomly fails!!
|
||||
}
|
||||
|
@@ -109,7 +109,7 @@ class ServerAPI{
|
||||
}
|
||||
if($this->getProperty("last-update") === false or ($this->getProperty("last-update") + 3600) < time()){
|
||||
console("[INFO] Checking for new server version");
|
||||
console("[INFO] Last check: ".date("Y-m-d H:i:s", $this->getProperty("last-update")));
|
||||
console("[INFO] Last check: \x1b[36m".date("Y-m-d H:i:s", $this->getProperty("last-update"))."\x1b[0m");
|
||||
$channel = "stable";
|
||||
if($this->getProperty("update-channel") == "dev" or $this->getProperty("update-channel") == "development"){
|
||||
$channel = "dev";
|
||||
@@ -124,13 +124,13 @@ class ServerAPI{
|
||||
$last = new DateTime($info["updated_at"]);
|
||||
$last = $last->getTimestamp();
|
||||
if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false){
|
||||
console("[NOTICE] A new DEVELOPMENT version of PocketMine-MP has been released");
|
||||
console("[NOTICE] If you want to update, get the latest version at https://github.com/shoghicp/PocketMine-MP/archive/master.zip");
|
||||
console("[NOTICE] \x1b[33mA new DEVELOPMENT version of PocketMine-MP has been released");
|
||||
console("[NOTICE] \x1b[36mIf you want to update, get the latest version at https://github.com/shoghicp/PocketMine-MP/archive/master.zip");
|
||||
console("[NOTICE] This message will dissapear when you issue the command \"/update-done\"");
|
||||
sleep(3);
|
||||
}else{
|
||||
$this->setProperty("last-update", time());
|
||||
console("[INFO] This is the latest DEVELOPMENT version");
|
||||
console("[INFO] \x1b[36mThis is the latest DEVELOPMENT version");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
@@ -151,14 +151,14 @@ class ServerAPI{
|
||||
|
||||
if($newest[0] !== -1){
|
||||
$target = $info[$newest[0]];
|
||||
console("[NOTICE] A new STABLE version of PocketMine-MP has been released");
|
||||
console("[NOTICE] Version \"".(new VersionString($newest[1]))."\" #".$newest[1]." [".substr($target["commit"]["sha"], 0, 10)."]");
|
||||
console("[NOTICE] \x1b[33mA new STABLE version of PocketMine-MP has been released");
|
||||
console("[NOTICE] \x1b[36mVersion \"".(new VersionString($newest[1]))."\" #".$newest[1]." [".substr($target["commit"]["sha"], 0, 10)."]");
|
||||
console("[NOTICE] Download it at ".$target["zipball_url"]);
|
||||
console("[NOTICE] This message will dissapear as soon as you update");
|
||||
sleep(5);
|
||||
}else{
|
||||
$this->setProperty("last-update", time());
|
||||
console("[INFO] This is the latest STABLE version");
|
||||
console("[INFO] \x1b[36mThis is the latest STABLE version");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ class ServerAPI{
|
||||
require_once($file);
|
||||
$this->$name = new $class($this->server);
|
||||
$this->apiList[] = $this->$name;
|
||||
console("[INFO] API ".$name." [".$class."] loaded");
|
||||
console("[INFO] API \x1b[36m".$name."\x1b[0m [\x1b[30m".$class."\x1b[0m] loaded");
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user