Added Dev tag to Config String

This commit is contained in:
Shoghi Cervantes Pueyo 2013-01-16 18:23:22 +01:00
parent d6ab1a9a87
commit 3d1d3e89ea
3 changed files with 21 additions and 6 deletions

View File

@ -32,7 +32,10 @@ class PocketMinecraftServer{
private function load(){
$this->version = new VersionString();
console("[INFO] \x1b[33;1mPocketMine-MP ".MAJOR_VERSION." #".$this->version->getNumber()." by @shoghicp, LGPL License", true, true, 0);
console("[DEBUG] Target Minecraft PE: ".CURRENT_MINECRAFT_VERSION.", protocol #".CURRENT_PROTOCOL, true, true, 2);
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->port);
if($this->port < 19132 or $this->port > 19135){
console("[WARNING] You've selected a not-standard port. Normal port range is from 19132 to 19135 included");

View File

@ -25,7 +25,6 @@ the Free Software Foundation, either version 3 of the License, or
*/
class VersionString{
public static $stageOrder = array(
"alpha" => 0,
@ -35,7 +34,11 @@ class VersionString{
"final" => 2,
"f" => 2,
);
private $stage, $major, $release, $minor;
private $stage;
private $major;
private $release;
private $minor;
private $development = false;
public function __construct($version = MAJOR_VERSION){
if(is_int($version)){
$this->minor = $version & 0x1F;
@ -43,11 +46,12 @@ class VersionString{
$this->generation = ($version >> 9) & 0x0F;
$this->stage = array_search(($version >> 13) & 0x0F, VersionString::$stageOrder, true);
}else{
$version = preg_split("/([A-Za-z]*)[ _\-]([0-9]*)\.([0-9]*)\.{0,1}([0-9]*)/", $version, -1, PREG_SPLIT_DELIM_CAPTURE);
$version = preg_split("/([A-Za-z]*)[ _\-]([0-9]*)\.([0-9]*)\.{0,1}([0-9]*)(dev|)/", $version, -1, PREG_SPLIT_DELIM_CAPTURE);
$this->stage = strtolower($version[1]); //0-15
$this->generation = (int) $version[2]; //0-15
$this->major = (int) $version[3]; //0-15
$this->minor = (int) $version[4]; //0-31
$this->development = $version[5] === "dev" ? true:false;
}
}
@ -74,9 +78,17 @@ class VersionString{
public function getRelease(){
return $this->generation . "." . $this->major . "." . $this->minor;
}
public function isDev(){
return $this->development === true;
}
public function get(){
return ucfirst($this->stage) . "_" . $this->getRelease() . ($this->development === true ? "dev":"");
}
public function __toString(){
return ucfirst($this->stage) . "_" . $this->generation . "." . $this->major . "." . $this->minor;
return $this->get();
}
public function compare($target, $diff = false){

View File

@ -38,6 +38,6 @@ ini_set("memory_limit", "256M");
define("LOG", true);
define("MAGIC", "\x00\xff\xff\x00\xfe\xfe\xfe\xfe\xfd\xfd\xfd\xfd\x12\x34\x56\x78");
define("TEST_MD5", "d0ca3786e53b615bb4fb9f5094d5c9a7");
define("MAJOR_VERSION", "Alpha_1.0.6");
define("MAJOR_VERSION", "Alpha_1.1dev");
define("CURRENT_PROTOCOL", 5);
define("CURRENT_MINECRAFT_VERSION", "v0.5.0 alpha");