Updated folders

This commit is contained in:
Shoghi Cervantes Pueyo 2012-12-28 15:27:49 +01:00
parent 8abc36acd4
commit b5c191530a
7 changed files with 15 additions and 15 deletions

2
.gitignore vendored
View File

@ -1,11 +1,11 @@
players/* players/*
worlds/* worlds/*
plugins/* plugins/*
logs/*
*.log *.log
server.properties server.properties
white-list.txt white-list.txt
banned-ips.txt banned-ips.txt
console.in
################# #################
## Eclipse ## Eclipse

View File

@ -30,7 +30,7 @@ class ConsoleAPI{
function __construct(PocketMinecraftServer $server){ function __construct(PocketMinecraftServer $server){
$this->help = array(); $this->help = array();
$this->server = $server; $this->server = $server;
$this->input = fopen(FILE_PATH."src/console.in", "w+b"); $this->input = fopen(FILE_PATH."logs/console.in", "w+b");
$this->last = microtime(true); $this->last = microtime(true);
} }

View File

@ -30,9 +30,14 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
private $server, $config, $apiList = array(); private $server, $config, $apiList = array();
function __construct(){ function __construct(){
console("[INFO] Starting ServerAPI server handler..."); console("[INFO] Starting ServerAPI server handler...");
file_put_contents(FILE_PATH."packets.log", ""); console("[DEBUG] Checking data folders...", true, true, 2);
file_put_contents(FILE_PATH."console.in", ""); @mkdir(FILE_PATH."logs/", 0777, true);
if(!file_exists(FILE_PATH."test.bin.log") or md5_file(FILE_PATH."test.bin.log") !== TEST_MD5){ @mkdir(FILE_PATH."players/", 0777);
@mkdir(FILE_PATH."worlds/", 0777);
@mkdir(FILE_PATH."plugins/", 0777);
file_put_contents(FILE_PATH."logs/packets.log", "");
file_put_contents(FILE_PATH."logs/console.in", "");
if(!file_exists(FILE_PATH."logs/test.bin.log") or md5_file(FILE_PATH."logs/test.bin.log") !== TEST_MD5){
console("[NOTICE] Executing integrity tests..."); console("[NOTICE] Executing integrity tests...");
console("[INFO] OS: ".PHP_OS.", ".Utils::getOS()); console("[INFO] OS: ".PHP_OS.", ".Utils::getOS());
console("[INFO] uname -a: ".php_uname("a")); console("[INFO] uname -a: ".php_uname("a"));
@ -60,7 +65,7 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
$test .= Utils::writeLong($str->hashCode()); $test .= Utils::writeLong($str->hashCode());
$test .= Utils::writeDataArray(array("a", "b", "c", "\xff\xff\xff\xff")); $test .= Utils::writeDataArray(array("a", "b", "c", "\xff\xff\xff\xff"));
$test .= Utils::hexToStr("012334567890"); $test .= Utils::hexToStr("012334567890");
file_put_contents(FILE_PATH."test.bin.log", $test); file_put_contents(FILE_PATH."logs/test.bin.log", $test);
if(md5($test) !== TEST_MD5){ if(md5($test) !== TEST_MD5){
console("[ERROR] Test error, please send your console.log + test.bin.log to the Github repo"); console("[ERROR] Test error, please send your console.log + test.bin.log to the Github repo");
die(); die();
@ -82,11 +87,6 @@ class ServerAPI extends stdClass{ //Yay! I can add anything to this class in run
copy(FILE_PATH."src/common/default.properties", FILE_PATH."server.properties"); copy(FILE_PATH."src/common/default.properties", FILE_PATH."server.properties");
} }
console("[DEBUG] Checking data folders...", true, true, 2);
@mkdir(FILE_PATH."players/", 0777, true);
@mkdir(FILE_PATH."worlds/", 0777);
@mkdir(FILE_PATH."plugins/", 0777);
console("[DEBUG] Loading server.properties...", true, true, 2); console("[DEBUG] Loading server.properties...", true, true, 2);
$this->parseProperties(); $this->parseProperties();
define("DEBUG", $this->config["debug"]); define("DEBUG", $this->config["debug"]);

View File

@ -30,7 +30,7 @@ class PocketMinecraftServer extends stdClass{
private $database, $interface, $evCnt, $handCnt, $events, $handlers, $version, $serverType, $lastTick; private $database, $interface, $evCnt, $handCnt, $events, $handlers, $version, $serverType, $lastTick;
function __construct($name, $gamemode = 1, $seed = false, $protocol = CURRENT_PROTOCOL, $port = 19132, $serverID = false, $version = CURRENT_VERSION){ function __construct($name, $gamemode = 1, $seed = false, $protocol = CURRENT_PROTOCOL, $port = 19132, $serverID = false, $version = CURRENT_VERSION){
$this->port = (int) $port; //19132 - 19135 $this->port = (int) $port; //19132 - 19135
console("[INFO] PocketMine-MP ".MAJOR_VERSION." by @shoghicp, LGPL License. http://bit.ly/TbrimG", true, true, 0); console("[INFO] PocketMine-MP ".MAJOR_VERSION." by @shoghicp, LGPL License", true, true, 0);
console("[INFO] Starting Minecraft PE Server at *:".$this->port); console("[INFO] Starting Minecraft PE Server at *:".$this->port);
if($this->port < 19132 or $this->port > 19135){ 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"); console("[WARNING] You've selected a not-standard port. Normal port range is from 19132 to 19135 included");

View File

@ -170,7 +170,7 @@ function logg($message, $name, $EOL = true, $level = 2, $close = false){
$fpointers = array(); $fpointers = array();
} }
if(!isset($fpointers[$name])){ if(!isset($fpointers[$name])){
$fpointers[$name] = fopen(FILE_PATH."/".$name.".log", "ab"); $fpointers[$name] = fopen(FILE_PATH."logs/".$name.".log", "ab");
} }
fwrite($fpointers[$name], $message); fwrite($fpointers[$name], $message);
if($close === true){ if($close === true){

View File

@ -25,7 +25,7 @@ the Free Software Foundation, either version 3 of the License, or
*/ */
$fp = fopen(dirname(__FILE__)."/console.in","wb"); $fp = fopen(dirname(__FILE__)."/../../logs/console.in","wb");
while(true){ while(true){
$l = fgets(STDIN); $l = fgets(STDIN);
fwrite($fp, $l); fwrite($fp, $l);

View File

@ -27,6 +27,6 @@ echo [ERROR] Couldn't find PHP binary in PATH.
ping 127.0.0.1 -n 3 -w 1000>nul ping 127.0.0.1 -n 3 -w 1000>nul
) else ( ) else (
START /B CMD /C CALL php PocketMine-MP.php START /B CMD /C CALL php PocketMine-MP.php
START /B /WAIT php src/input.php 1 START /B /WAIT php src/common/input.php 1
ping 127.0.0.1 -n 5 -w 1000>nul ping 127.0.0.1 -n 5 -w 1000>nul
) )