mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-17 11:18:52 +00:00
Updated TextFormat constants
This commit is contained in:
parent
4a2852bb90
commit
103d0bf2ea
@ -130,7 +130,7 @@ class ConsoleAPI{
|
|||||||
|
|
||||||
$max = ceil(count($cmds) / 5);
|
$max = ceil(count($cmds) / 5);
|
||||||
$page = (int) (isset($params[0]) ? min($max, max(1, intval($params[0]))):1);
|
$page = (int) (isset($params[0]) ? min($max, max(1, intval($params[0]))):1);
|
||||||
$output .= FORMAT_RED."-".FORMAT_RESET." Showing help page $page of $max (/help <page>) ".FORMAT_RED."-".FORMAT_RESET."\n";
|
$output .= TextFormat::RED."-".TextFormat::RESET." Showing help page $page of $max (/help <page>) ".TextFormat::RED."-".TextFormat::RESET."\n";
|
||||||
$current = 1;
|
$current = 1;
|
||||||
foreach($cmds as $c => $h){
|
foreach($cmds as $c => $h){
|
||||||
$curpage = (int) ceil($current / 5);
|
$curpage = (int) ceil($current / 5);
|
||||||
@ -177,9 +177,9 @@ class ConsoleAPI{
|
|||||||
return $this->run($this->alias[$cmd] . ($params !== "" ? " " .$params:""), $issuer, $cmd);
|
return $this->run($this->alias[$cmd] . ($params !== "" ? " " .$params:""), $issuer, $cmd);
|
||||||
}
|
}
|
||||||
if($issuer instanceof Player){
|
if($issuer instanceof Player){
|
||||||
console("[DEBUG] ".FORMAT_AQUA.$issuer->username.FORMAT_RESET." issued server command: ".ltrim("$alias ")."/$cmd ".$params, true, true, 2);
|
console("[DEBUG] ".TextFormat::AQUA.$issuer->username.TextFormat::RESET." issued server command: ".ltrim("$alias ")."/$cmd ".$params, true, true, 2);
|
||||||
}else{
|
}else{
|
||||||
console("[DEBUG] ".FORMAT_YELLOW."*".$issuer.FORMAT_RESET." issued server command: ".ltrim("$alias ")."/$cmd ".$params, true, true, 2);
|
console("[DEBUG] ".TextFormat::YELLOW."*".$issuer.TextFormat::RESET." issued server command: ".ltrim("$alias ")."/$cmd ".$params, true, true, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(preg_match_all('#@([@a-z]{1,})#', $params, $matches, PREG_OFFSET_CAPTURE) > 0){
|
if(preg_match_all('#@([@a-z]{1,})#', $params, $matches, PREG_OFFSET_CAPTURE) > 0){
|
||||||
|
@ -111,7 +111,7 @@ class PluginAPI extends stdClass{
|
|||||||
console("[ERROR] Failed parsing of ".basename($file));
|
console("[ERROR] Failed parsing of ".basename($file));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
console("[INFO] Loading plugin \"".FORMAT_GREEN.$info["name"].FORMAT_RESET."\" ".FORMAT_AQUA.$info["version"].FORMAT_RESET." by ".FORMAT_AQUA.$info["author"].FORMAT_RESET);
|
console("[INFO] Loading plugin \"".TextFormat::GREEN.$info["name"].TextFormat::RESET."\" ".TextFormat::AQUA.$info["version"].TextFormat::RESET." by ".TextFormat::AQUA.$info["author"].TextFormat::RESET);
|
||||||
if($info["class"] !== "none" and class_exists($info["class"])){
|
if($info["class"] !== "none" and class_exists($info["class"])){
|
||||||
console("[ERROR] Failed loading plugin: class already exists");
|
console("[ERROR] Failed loading plugin: class already exists");
|
||||||
return false;
|
return false;
|
||||||
|
@ -102,7 +102,7 @@ class ServerAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$version = new VersionString();
|
$version = new VersionString();
|
||||||
console("[INFO] Starting Minecraft PE server version ".FORMAT_AQUA.CURRENT_MINECRAFT_VERSION);
|
console("[INFO] Starting Minecraft PE server version ".TextFormat::AQUA.CURRENT_MINECRAFT_VERSION);
|
||||||
|
|
||||||
console("[INFO] Loading properties...");
|
console("[INFO] Loading properties...");
|
||||||
$this->config = new Config(DATA_PATH . "server.properties", Config::PROPERTIES, array(
|
$this->config = new Config(DATA_PATH . "server.properties", Config::PROPERTIES, array(
|
||||||
@ -153,12 +153,12 @@ class ServerAPI{
|
|||||||
$this->server = new MainServer($this->getProperty("server-name"), $this->getProperty("gamemode"), ($seed = $this->getProperty("level-seed")) != "" ? (int) $seed:false, $this->getProperty("server-port"), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0");
|
$this->server = new MainServer($this->getProperty("server-name"), $this->getProperty("gamemode"), ($seed = $this->getProperty("level-seed")) != "" ? (int) $seed:false, $this->getProperty("server-port"), ($ip = $this->getProperty("server-ip")) != "" ? $ip:"0.0.0.0");
|
||||||
$this->server->api = $this;
|
$this->server->api = $this;
|
||||||
self::$serverRequest = $this->server;
|
self::$serverRequest = $this->server;
|
||||||
console("[INFO] This server is running PocketMine-MP version ".($version->isDev() ? FORMAT_YELLOW:"").MAJOR_VERSION.FORMAT_RESET." \"".CODENAME."\" (MCPE: ".CURRENT_MINECRAFT_VERSION.") (API ".CURRENT_API_VERSION.")", true, true, 0);
|
console("[INFO] This server is running PocketMine-MP version ".($version->isDev() ? TextFormat::YELLOW:"").MAJOR_VERSION.TextFormat::RESET." \"".CODENAME."\" (MCPE: ".CURRENT_MINECRAFT_VERSION.") (API ".CURRENT_API_VERSION.")", true, true, 0);
|
||||||
console("[INFO] PocketMine-MP is distributed under the LGPL License", true, true, 0);
|
console("[INFO] PocketMine-MP is distributed under the LGPL License", true, true, 0);
|
||||||
|
|
||||||
if($this->getProperty("last-update") === false or ($this->getProperty("last-update") + 3600) < time()){
|
if($this->getProperty("last-update") === false or ($this->getProperty("last-update") + 3600) < time()){
|
||||||
console("[INFO] Checking for new server version");
|
console("[INFO] Checking for new server version");
|
||||||
console("[INFO] Last check: ".FORMAT_AQUA.date("Y-m-d H:i:s", $this->getProperty("last-update"))."\x1b[0m");
|
console("[INFO] Last check: ".TextFormat::AQUA.date("Y-m-d H:i:s", $this->getProperty("last-update"))."\x1b[0m");
|
||||||
if($this->server->version->isDev()){
|
if($this->server->version->isDev()){
|
||||||
$info = json_decode(Utils::curl_get("https://api.github.com/repos/PocketMine/PocketMine-MP/commits"), true);
|
$info = json_decode(Utils::curl_get("https://api.github.com/repos/PocketMine/PocketMine-MP/commits"), true);
|
||||||
if($info === false or !isset($info[0])){
|
if($info === false or !isset($info[0])){
|
||||||
@ -167,13 +167,13 @@ class ServerAPI{
|
|||||||
$last = new DateTime($info[0]["commit"]["committer"]["date"]);
|
$last = new DateTime($info[0]["commit"]["committer"]["date"]);
|
||||||
$last = $last->getTimestamp();
|
$last = $last->getTimestamp();
|
||||||
if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false and GIT_COMMIT != $info[0]["sha"]){
|
if($last >= $this->getProperty("last-update") and $this->getProperty("last-update") !== false and GIT_COMMIT != $info[0]["sha"]){
|
||||||
console("[NOTICE] ".FORMAT_YELLOW."A new DEVELOPMENT version of PocketMine-MP has been released!");
|
console("[NOTICE] ".TextFormat::YELLOW."A new DEVELOPMENT version of PocketMine-MP has been released!");
|
||||||
console("[NOTICE] ".FORMAT_YELLOW."Commit \"".$info[0]["commit"]["message"]."\" [".substr($info[0]["sha"], 0, 10)."] by ".$info[0]["commit"]["committer"]["name"]);
|
console("[NOTICE] ".TextFormat::YELLOW."Commit \"".$info[0]["commit"]["message"]."\" [".substr($info[0]["sha"], 0, 10)."] by ".$info[0]["commit"]["committer"]["name"]);
|
||||||
console("[NOTICE] ".FORMAT_YELLOW."Get it at PocketMine.net or at https://github.com/PocketMine/PocketMine-MP/archive/".$info[0]["sha"].".zip");
|
console("[NOTICE] ".TextFormat::YELLOW."Get it at PocketMine.net or at https://github.com/PocketMine/PocketMine-MP/archive/".$info[0]["sha"].".zip");
|
||||||
console("[NOTICE] This message will dissapear after issuing the command \"/update-done\"");
|
console("[NOTICE] This message will dissapear after issuing the command \"/update-done\"");
|
||||||
}else{
|
}else{
|
||||||
$this->setProperty("last-update", time());
|
$this->setProperty("last-update", time());
|
||||||
console("[INFO] ".FORMAT_AQUA."This is the latest DEVELOPMENT version");
|
console("[INFO] ".TextFormat::AQUA."This is the latest DEVELOPMENT version");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
@ -186,13 +186,13 @@ class ServerAPI{
|
|||||||
$update = new VersionString($info[0]["name"]);
|
$update = new VersionString($info[0]["name"]);
|
||||||
$updateN = $update->getNumber();
|
$updateN = $update->getNumber();
|
||||||
if($updateN > $newestN){
|
if($updateN > $newestN){
|
||||||
console("[NOTICE] ".FORMAT_GREEN."A new STABLE version of PocketMine-MP has been released!");
|
console("[NOTICE] ".TextFormat::GREEN."A new STABLE version of PocketMine-MP has been released!");
|
||||||
console("[NOTICE] ".FORMAT_GREEN."Version \"".$info[0]["name"]."\" #".$updateN);
|
console("[NOTICE] ".TextFormat::GREEN."Version \"".$info[0]["name"]."\" #".$updateN);
|
||||||
console("[NOTICE] Get it at PocketMine.net or at ".$info[0]["zipball_url"]);
|
console("[NOTICE] Get it at PocketMine.net or at ".$info[0]["zipball_url"]);
|
||||||
console("[NOTICE] This message will dissapear as soon as you update");
|
console("[NOTICE] This message will dissapear as soon as you update");
|
||||||
}else{
|
}else{
|
||||||
$this->setProperty("last-update", time());
|
$this->setProperty("last-update", time());
|
||||||
console("[INFO] ".FORMAT_AQUA."This is the latest STABLE version");
|
console("[INFO] ".TextFormat::AQUA."This is the latest STABLE version");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -320,7 +320,7 @@ class Player{
|
|||||||
$this->server->api->chat->broadcast($this->username." left the game");
|
$this->server->api->chat->broadcast($this->username." left the game");
|
||||||
}
|
}
|
||||||
$this->spawned = false;
|
$this->spawned = false;
|
||||||
console("[INFO] ".FORMAT_AQUA.$this->username.FORMAT_RESET."[/".$this->ip.":".$this->port."] logged out due to ".$reason);
|
console("[INFO] ".TextFormat::AQUA.$this->username.TextFormat::RESET."[/".$this->ip.":".$this->port."] logged out due to ".$reason);
|
||||||
$this->windows = array();
|
$this->windows = array();
|
||||||
$this->armor = array();
|
$this->armor = array();
|
||||||
$this->inventory = array();
|
$this->inventory = array();
|
||||||
@ -1453,7 +1453,7 @@ class Player{
|
|||||||
$this->evid[] = $this->server->event("tile.update", array($this, "eventHandler"));
|
$this->evid[] = $this->server->event("tile.update", array($this, "eventHandler"));
|
||||||
$this->lastMeasure = microtime(true);
|
$this->lastMeasure = microtime(true);
|
||||||
$this->server->schedule(50, array($this, "measureLag"), array(), true);
|
$this->server->schedule(50, array($this, "measureLag"), array(), true);
|
||||||
console("[INFO] ".FORMAT_AQUA.$this->username.FORMAT_RESET."[/".$this->ip.":".$this->port."] logged in with entity id ".$this->eid." at (".$this->entity->level->getName().", ".round($this->entity->x, 2).", ".round($this->entity->y, 2).", ".round($this->entity->z, 2).")");
|
console("[INFO] ".TextFormat::AQUA.$this->username.TextFormat::RESET."[/".$this->ip.":".$this->port."] logged in with entity id ".$this->eid." at (".$this->entity->level->getName().", ".round($this->entity->x, 2).", ".round($this->entity->y, 2).", ".round($this->entity->z, 2).")");
|
||||||
break;
|
break;
|
||||||
case ProtocolInfo::READY_PACKET:
|
case ProtocolInfo::READY_PACKET:
|
||||||
if($this->loggedIn === false){
|
if($this->loggedIn === false){
|
||||||
|
@ -181,7 +181,7 @@ function arguments($args){
|
|||||||
function console($message, $EOL = true, $log = true, $level = 1){
|
function console($message, $EOL = true, $log = true, $level = 1){
|
||||||
if(!defined("DEBUG") or DEBUG >= $level){
|
if(!defined("DEBUG") or DEBUG >= $level){
|
||||||
$message .= $EOL === true ? PHP_EOL:"";
|
$message .= $EOL === true ? PHP_EOL:"";
|
||||||
$time = (ENABLE_ANSI === true ? FORMAT_AQUA . date("H:i:s") . FORMAT_RESET:date("H:i:s")) . " ";
|
$time = (ENABLE_ANSI === true ? TextFormat::AQUA . date("H:i:s") . TextFormat::RESET:date("H:i:s")) . " ";
|
||||||
$replaced = TextFormat::clean(preg_replace('/\x1b\[[0-9;]*m/', "", $time . $message));
|
$replaced = TextFormat::clean(preg_replace('/\x1b\[[0-9;]*m/', "", $time . $message));
|
||||||
if($log === true and (!defined("LOG") or LOG === true)){
|
if($log === true and (!defined("LOG") or LOG === true)){
|
||||||
logg(date("Y-m-d")." ".$replaced, "console", false, $level);
|
logg(date("Y-m-d")." ".$replaced, "console", false, $level);
|
||||||
@ -192,24 +192,24 @@ function console($message, $EOL = true, $log = true, $level = 1){
|
|||||||
switch($matches[1]){
|
switch($matches[1]){
|
||||||
case "ERROR":
|
case "ERROR":
|
||||||
case "SEVERE":
|
case "SEVERE":
|
||||||
$add .= FORMAT_RED;
|
$add .= TextFormat::RED;
|
||||||
break;
|
break;
|
||||||
case "INTERNAL":
|
case "INTERNAL":
|
||||||
case "DEBUG":
|
case "DEBUG":
|
||||||
$add .= FORMAT_GRAY;
|
$add .= TextFormat::GRAY;
|
||||||
break;
|
break;
|
||||||
case "WARNING":
|
case "WARNING":
|
||||||
$add .= FORMAT_YELLOW;
|
$add .= TextFormat::YELLOW;
|
||||||
break;
|
break;
|
||||||
case "NOTICE":
|
case "NOTICE":
|
||||||
$add .= FORMAT_AQUA;
|
$add .= TextFormat::AQUA;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$add = "";
|
$add = "";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$message = TextFormat::toANSI($time . $add . $message . FORMAT_RESET);
|
$message = TextFormat::toANSI($time . $add . $message . TextFormat::RESET);
|
||||||
}else{
|
}else{
|
||||||
$message = $replaced;
|
$message = $replaced;
|
||||||
}
|
}
|
||||||
|
@ -51,9 +51,9 @@ class BurningFurnaceBlock extends SolidBlock{
|
|||||||
if($t !== false){
|
if($t !== false){
|
||||||
$furnace = $t;
|
$furnace = $t;
|
||||||
}else{
|
}else{
|
||||||
$furnace = $server->api->tile->add($this->level, TILE_FURNACE, $this->x, $this->y, $this->z, array(
|
$furnace = $server->api->tile->add($this->level, Tile::FURNACE, $this->x, $this->y, $this->z, array(
|
||||||
"Items" => array(),
|
"Items" => array(),
|
||||||
"id" => TILE_FURNACE,
|
"id" => Tile::FURNACE,
|
||||||
"x" => $this->x,
|
"x" => $this->x,
|
||||||
"y" => $this->y,
|
"y" => $this->y,
|
||||||
"z" => $this->z
|
"z" => $this->z
|
||||||
@ -94,7 +94,7 @@ class BurningFurnaceBlock extends SolidBlock{
|
|||||||
$drops[] = array(FURNACE, 0, 1);
|
$drops[] = array(FURNACE, 0, 1);
|
||||||
}
|
}
|
||||||
$t = ServerAPI::request()->api->tile->get($this);
|
$t = ServerAPI::request()->api->tile->get($this);
|
||||||
if($t !== false and $t->class === TILE_FURNACE){
|
if($t !== false and $t->class === Tile::FURNACE){
|
||||||
for($s = 0; $s < FURNACE_SLOTS; ++$s){
|
for($s = 0; $s < FURNACE_SLOTS; ++$s){
|
||||||
$slot = $t->getSlot($s);
|
$slot = $t->getSlot($s);
|
||||||
if($slot->getID() > AIR and $slot->count > 0){
|
if($slot->getID() > AIR and $slot->count > 0){
|
||||||
|
@ -53,9 +53,9 @@ class ChestBlock extends TransparentBlock{
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->level->setBlock($block, $this, true, false, true);
|
$this->level->setBlock($block, $this, true, false, true);
|
||||||
$tile = $server->api->tile->add($this->level, TILE_CHEST, $this->x, $this->y, $this->z, array(
|
$tile = $server->api->tile->add($this->level, Tile::CHEST, $this->x, $this->y, $this->z, array(
|
||||||
"Items" => array(),
|
"Items" => array(),
|
||||||
"id" => TILE_CHEST,
|
"id" => Tile::CHEST,
|
||||||
"x" => $this->x,
|
"x" => $this->x,
|
||||||
"y" => $this->y,
|
"y" => $this->y,
|
||||||
"z" => $this->z
|
"z" => $this->z
|
||||||
@ -89,9 +89,9 @@ class ChestBlock extends TransparentBlock{
|
|||||||
if($t !== false){
|
if($t !== false){
|
||||||
$chest = $t;
|
$chest = $t;
|
||||||
}else{
|
}else{
|
||||||
$chest = $server->api->tile->add($this->level, TILE_CHEST, $this->x, $this->y, $this->z, array(
|
$chest = $server->api->tile->add($this->level, Tile::CHEST, $this->x, $this->y, $this->z, array(
|
||||||
"Items" => array(),
|
"Items" => array(),
|
||||||
"id" => TILE_CHEST,
|
"id" => Tile::CHEST,
|
||||||
"x" => $this->x,
|
"x" => $this->x,
|
||||||
"y" => $this->y,
|
"y" => $this->y,
|
||||||
"z" => $this->z
|
"z" => $this->z
|
||||||
@ -113,7 +113,7 @@ class ChestBlock extends TransparentBlock{
|
|||||||
array($this->id, 0, 1),
|
array($this->id, 0, 1),
|
||||||
);
|
);
|
||||||
$t = ServerAPI::request()->api->tile->get($this);
|
$t = ServerAPI::request()->api->tile->get($this);
|
||||||
if($t !== false and $t->class === TILE_CHEST){
|
if($t !== false and $t->class === Tile::CHEST){
|
||||||
for($s = 0; $s < CHEST_SLOTS; ++$s){
|
for($s = 0; $s < CHEST_SLOTS; ++$s){
|
||||||
$slot = $t->getSlot($s);
|
$slot = $t->getSlot($s);
|
||||||
if($slot->getID() > AIR and $slot->count > 0){
|
if($slot->getID() > AIR and $slot->count > 0){
|
||||||
|
@ -65,7 +65,7 @@ abstract class ProtocolInfo{
|
|||||||
const ADD_PAINTING_PACKET = 0x99;
|
const ADD_PAINTING_PACKET = 0x99;
|
||||||
const EXPLODE_PACKET = 0x9a;
|
const EXPLODE_PACKET = 0x9a;
|
||||||
const LEVEL_EVENT_PACKET = 0x9b;
|
const LEVEL_EVENT_PACKET = 0x9b;
|
||||||
const TILE_EVENT_PACKET = 0x9c;
|
const Tile::EVENT_PACKET = 0x9c;
|
||||||
const ENTITY_EVENT_PACKET = 0x9d;
|
const ENTITY_EVENT_PACKET = 0x9d;
|
||||||
const REQUEST_CHUNK_PACKET = 0x9e;
|
const REQUEST_CHUNK_PACKET = 0x9e;
|
||||||
const CHUNK_DATA_PACKET = 0x9f;
|
const CHUNK_DATA_PACKET = 0x9f;
|
||||||
|
@ -27,7 +27,7 @@ class TileEventPacket extends RakNetDataPacket{
|
|||||||
public $case2;
|
public $case2;
|
||||||
|
|
||||||
public function pid(){
|
public function pid(){
|
||||||
return ProtocolInfo::TILE_EVENT_PACKET;
|
return ProtocolInfo::Tile::EVENT_PACKET;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function decode(){
|
public function decode(){
|
||||||
|
@ -268,7 +268,7 @@ class RakNetParser{
|
|||||||
case ProtocolInfo::LEVEL_EVENT_PACKET:
|
case ProtocolInfo::LEVEL_EVENT_PACKET:
|
||||||
$data = new LevelEventPacket;
|
$data = new LevelEventPacket;
|
||||||
break;
|
break;
|
||||||
case ProtocolInfo::TILE_EVENT_PACKET:
|
case ProtocolInfo::Tile::EVENT_PACKET:
|
||||||
$data = new TileEventPacket;
|
$data = new TileEventPacket;
|
||||||
break;
|
break;
|
||||||
case ProtocolInfo::ENTITY_EVENT_PACKET:
|
case ProtocolInfo::ENTITY_EVENT_PACKET:
|
||||||
|
@ -4,9 +4,9 @@
|
|||||||
function testCase($name, $output, $expected){
|
function testCase($name, $output, $expected){
|
||||||
global $testErrors;
|
global $testErrors;
|
||||||
if($output === $expected){
|
if($output === $expected){
|
||||||
console("[TEST] $name: ".FORMAT_GREEN."Ok.");
|
console("[TEST] $name: ".TextFormat::GREEN."Ok.");
|
||||||
}else{
|
}else{
|
||||||
console("[TEST] $name: ".FORMAT_RED."Error.");
|
console("[TEST] $name: ".TextFormat::RED."Error.");
|
||||||
console("Expected ".print_r($expected, true).", got ".print_r($output, true));
|
console("Expected ".print_r($expected, true).", got ".print_r($output, true));
|
||||||
++$testErrors;
|
++$testErrors;
|
||||||
}
|
}
|
||||||
@ -17,15 +17,15 @@
|
|||||||
require_once(dirname(__FILE__)."/../dependencies.php");
|
require_once(dirname(__FILE__)."/../dependencies.php");
|
||||||
require_once(FILE_PATH."/src/functions.php");
|
require_once(FILE_PATH."/src/functions.php");
|
||||||
require_once(FILE_PATH."/src/dependencies.php");
|
require_once(FILE_PATH."/src/dependencies.php");
|
||||||
console(FORMAT_GREEN . "[TEST] Starting tests");
|
console(TextFormat::GREEN . "[TEST] Starting tests");
|
||||||
testCase("dummy", dummy(), null);
|
testCase("dummy", dummy(), null);
|
||||||
$t = new ServerSuiteTest;
|
$t = new ServerSuiteTest;
|
||||||
echo PHP_EOL;
|
echo PHP_EOL;
|
||||||
if($testErrors === 0){
|
if($testErrors === 0){
|
||||||
console(FORMAT_GREEN . "[TEST] No errors. Test complete.");
|
console(TextFormat::GREEN . "[TEST] No errors. Test complete.");
|
||||||
exit(0);
|
exit(0);
|
||||||
}else{
|
}else{
|
||||||
console(FORMAT_RED . "[TEST] Errors found.");
|
console(TextFormat::RED . "[TEST] Errors found.");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,32 +19,31 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
define("FORMAT_BLACK", "§0");
|
|
||||||
define("FORMAT_DARK_BLUE", "§1");
|
|
||||||
define("FORMAT_DARK_GREEN", "§2");
|
|
||||||
define("FORMAT_DARK_AQUA", "§3");
|
|
||||||
define("FORMAT_DARK_RED", "§4");
|
|
||||||
define("FORMAT_DARK_PURPLE", "§5");
|
|
||||||
define("FORMAT_GOLD", "§6");
|
|
||||||
define("FORMAT_GRAY", "§7");
|
|
||||||
define("FORMAT_DARK_GRAY", "§8");
|
|
||||||
define("FORMAT_BLUE", "§9");
|
|
||||||
define("FORMAT_GREEN", "§a");
|
|
||||||
define("FORMAT_AQUA", "§b");
|
|
||||||
define("FORMAT_RED", "§c");
|
|
||||||
define("FORMAT_LIGHT_PURPLE", "§d");
|
|
||||||
define("FORMAT_YELLOW", "§e");
|
|
||||||
define("FORMAT_WHITE", "§f");
|
|
||||||
|
|
||||||
define("FORMAT_OBFUSCATED", "§k");
|
|
||||||
define("FORMAT_BOLD", "§l");
|
|
||||||
define("FORMAT_STRIKETHROUGH", "§m");
|
|
||||||
define("FORMAT_UNDERLINE", "§n");
|
|
||||||
define("FORMAT_ITALIC", "§o");
|
|
||||||
define("FORMAT_RESET", "§r");
|
|
||||||
|
|
||||||
|
|
||||||
class TextFormat{
|
class TextFormat{
|
||||||
|
const BLACK = "§0";
|
||||||
|
const DARK_BLUE = "§1";
|
||||||
|
const DARK_GREEN = "§2";
|
||||||
|
const DARK_AQUA = "§3";
|
||||||
|
const DARK_RED = "§4";
|
||||||
|
const DARK_PURPLE = "§5";
|
||||||
|
const GOLD = "§6";
|
||||||
|
const GRAY = "§7";
|
||||||
|
const DARK_GRAY = "§8";
|
||||||
|
const BLUE = "§9";
|
||||||
|
const GREEN = "§a";
|
||||||
|
const AQUA = "§b";
|
||||||
|
const RED = "§c";
|
||||||
|
const LIGHT_PURPLE = "§d";
|
||||||
|
const YELLOW = "§e";
|
||||||
|
const WHITE = "§f";
|
||||||
|
|
||||||
|
const OBFUSCATED = "§k";
|
||||||
|
const BOLD = "§l";
|
||||||
|
const STRIKETHROUGH = "§m";
|
||||||
|
const UNDERLINE = "§n";
|
||||||
|
const ITALIC = "§o";
|
||||||
|
const RESET = "§r";
|
||||||
|
|
||||||
public static function tokenize($string){
|
public static function tokenize($string){
|
||||||
return preg_split("/(§[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
return preg_split("/(§[0123456789abcdefklmnor])/", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||||
}
|
}
|
||||||
@ -60,70 +59,70 @@ class TextFormat{
|
|||||||
$newString = "";
|
$newString = "";
|
||||||
foreach($string as $token){
|
foreach($string as $token){
|
||||||
switch($token){
|
switch($token){
|
||||||
case FORMAT_BOLD:
|
case TextFormat::BOLD:
|
||||||
break;
|
break;
|
||||||
case FORMAT_OBFUSCATED:
|
case TextFormat::OBFUSCATED:
|
||||||
$newString .= "\x1b[8m";
|
$newString .= "\x1b[8m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_ITALIC:
|
case TextFormat::ITALIC:
|
||||||
$newString .= "\x1b[3m";
|
$newString .= "\x1b[3m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_UNDERLINE:
|
case TextFormat::UNDERLINE:
|
||||||
$newString .= "\x1b[4m";
|
$newString .= "\x1b[4m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_STRIKETHROUGH:
|
case TextFormat::STRIKETHROUGH:
|
||||||
$newString .= "\x1b[9m";
|
$newString .= "\x1b[9m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_RESET:
|
case TextFormat::RESET:
|
||||||
$newString .= "\x1b[0m";
|
$newString .= "\x1b[0m";
|
||||||
break;
|
break;
|
||||||
//Colors
|
//Colors
|
||||||
case FORMAT_BLACK:
|
case TextFormat::BLACK:
|
||||||
$newString .= "\x1b[30m";
|
$newString .= "\x1b[30m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_DARK_BLUE:
|
case TextFormat::DARK_BLUE:
|
||||||
$newString .= "\x1b[34m";
|
$newString .= "\x1b[34m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_DARK_GREEN:
|
case TextFormat::DARK_GREEN:
|
||||||
$newString .= "\x1b[32m";
|
$newString .= "\x1b[32m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_DARK_AQUA:
|
case TextFormat::DARK_AQUA:
|
||||||
$newString .= "\x1b[36m";
|
$newString .= "\x1b[36m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_DARK_RED:
|
case TextFormat::DARK_RED:
|
||||||
$newString .= "\x1b[31m";
|
$newString .= "\x1b[31m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_DARK_PURPLE:
|
case TextFormat::DARK_PURPLE:
|
||||||
$newString .= "\x1b[35m";
|
$newString .= "\x1b[35m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_GOLD:
|
case TextFormat::GOLD:
|
||||||
$newString .= "\x1b[33m";
|
$newString .= "\x1b[33m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_GRAY:
|
case TextFormat::GRAY:
|
||||||
$newString .= "\x1b[37m";
|
$newString .= "\x1b[37m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_DARK_GRAY:
|
case TextFormat::DARK_GRAY:
|
||||||
$newString .= "\x1b[30;1m";
|
$newString .= "\x1b[30;1m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_BLUE:
|
case TextFormat::BLUE:
|
||||||
$newString .= "\x1b[34;1m";
|
$newString .= "\x1b[34;1m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_GREEN:
|
case TextFormat::GREEN:
|
||||||
$newString .= "\x1b[32;1m";
|
$newString .= "\x1b[32;1m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_AQUA:
|
case TextFormat::AQUA:
|
||||||
$newString .= "\x1b[36;1m";
|
$newString .= "\x1b[36;1m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_RED:
|
case TextFormat::RED:
|
||||||
$newString .= "\x1b[31;1m";
|
$newString .= "\x1b[31;1m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_LIGHT_PURPLE:
|
case TextFormat::LIGHT_PURPLE:
|
||||||
$newString .= "\x1b[35;1m";
|
$newString .= "\x1b[35;1m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_YELLOW:
|
case TextFormat::YELLOW:
|
||||||
$newString .= "\x1b[33;1m";
|
$newString .= "\x1b[33;1m";
|
||||||
break;
|
break;
|
||||||
case FORMAT_WHITE:
|
case TextFormat::WHITE:
|
||||||
$newString .= "\x1b[37;1m";
|
$newString .= "\x1b[37;1m";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -49,7 +49,7 @@ class LevelImport{
|
|||||||
}
|
}
|
||||||
$tiles = $entities->TileEntities;
|
$tiles = $entities->TileEntities;
|
||||||
$entities = $entities->Entities;
|
$entities = $entities->Entities;
|
||||||
$entities = new Config($this->path."entities.yml", CONFIG_YAML, $entities);
|
$entities = new Config($this->path."entities.yml", Config::YAML, $entities);
|
||||||
$entities->save();
|
$entities->save();
|
||||||
$tiles = new Config($this->path."tiles.yml", Config::YAML, $tiles);
|
$tiles = new Config($this->path."tiles.yml", Config::YAML, $tiles);
|
||||||
$tiles->save();
|
$tiles->save();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user