Changes made to be compatible with the DevTools plugin

This commit is contained in:
Shoghi Cervantes Pueyo 2013-02-14 20:37:16 +01:00
parent 717c668787
commit 874571d572
159 changed files with 53 additions and 37 deletions

View File

@ -25,8 +25,12 @@ the Free Software Foundation, either version 3 of the License, or
*/
require_once(dirname(__FILE__)."/src/dependencies.php");
require_once("API/ServerAPI.php");
/***REM_START***/
require_once(dirname(__FILE__)."/src/config.php");
require_once(FILE_PATH."/src/functions.php");
require_once(FILE_PATH."/src/dependencies.php");
/***REM_END***/
$server = new ServerAPI();
$server->run();//$server->start();

View File

@ -191,19 +191,19 @@ class ServerAPI{
}
$this->loadProperties();
$this->server->loadMap();
//Autoload all default APIs
console("[INFO] Loading default APIs");
$dir = dir(FILE_PATH."src/API/");
while(false !== ($file = $dir->read())){
if($file{0} !== "."){ //Hidden and upwards folders
$API = basename($file, ".php");
if(strtolower($API) !== "serverapi" and strtolower($API) !== "pluginapi"){
$name = strtolower(substr($API, 0, -3));
$this->loadAPI($name, $API);
}
}
}
$this->loadAPI("console", "ConsoleAPI");
$this->loadAPI("level", "LevelAPI");
$this->loadAPI("block", "BlockAPI");
$this->loadAPI("chat", "ChatAPI");
$this->loadAPI("ban", "BanAPI");
$this->loadAPI("entity", "EntityAPI");
$this->loadAPI("tileentity", "TileEntityAPI");
$this->loadAPI("player", "PlayerAPI");
$this->loadAPI("time", "TimeAPI");
foreach($this->apiList as $ob){
if(is_callable(array($ob, "init"))){
$ob->init(); //Fails sometimes!!!
@ -448,15 +448,19 @@ class ServerAPI{
}
public function loadAPI($name, $class, $dir = false){
if($dir === false){
$dir = FILE_PATH."src/API/";
}
$file = $dir.$class.".php";
if(!file_exists($file)){
console("[ERROR] API ".$name." [".$class."] in ".$dir." doesn't exist", true, true, 0);
if(isset($this->$name)){
return false;
}elseif(!class_exists($class)){
if($dir === false){
$dir = FILE_PATH."src/API/";
}
$file = $dir.$class.".php";
if(!file_exists($file)){
console("[ERROR] API ".$name." [".$class."] in ".$dir." doesn't exist", true, true, 0);
return false;
}
require_once($file);
}
require_once($file);
$this->$name = new $class($this->server);
$this->apiList[] = $this->$name;
console("[INFO] API \x1b[36m".$name."\x1b[0m [\x1b[30;1m".$class."\x1b[0m] loaded");

View File

@ -32,8 +32,8 @@ error_reporting(E_ALL ^ E_NOTICE);
ini_set("allow_url_fopen", 1);
ini_set("display_errors", 1);
ini_set('default_charset', 'utf-8');
define("FILE_PATH", dirname(__FILE__)."/../");
set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH . PATH_SEPARATOR . FILE_PATH . "/src/" . PATH_SEPARATOR . FILE_PATH . "/src/classes/");
define("FILE_PATH", dirname(get_included_files()[0])."/");
set_include_path(get_include_path() . PATH_SEPARATOR . FILE_PATH);
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");

View File

@ -25,8 +25,11 @@ the Free Software Foundation, either version 3 of the License, or
*/
/***REM_START***/
require_once(dirname(__FILE__)."/config.php");
require_once(dirname(__FILE__)."/functions.php");
require_once(FILE_PATH."/src/functions.php");
/***REM_END***/
if(strpos(strtoupper(php_uname("s")), "WIN") === false or arg("enable-ansi", false) === true){
define("ENABLE_ANSI", true);
}else{
@ -81,6 +84,9 @@ if($errors > 0){
exit(1); //Exit with error
}
require_all(FILE_PATH . "src/classes/");
/***REM_START***/
require_all(FILE_PATH . "src/");
/***REM_END***/
?>

View File

@ -25,8 +25,6 @@ the Free Software Foundation, either version 3 of the License, or
*/
require_once("classes/material/IDs.php");
abstract class Block{
public static $class = array(
AIR => "AirBlock",
@ -199,6 +197,7 @@ abstract class Block{
abstract function onUpdate(BlockAPI $level, $type);
}
/***REM_START***/
require_once("block/GenericBlock.php");
require_once("block/SolidBlock.php");
require_once("block/TransparentBlock.php");
@ -206,3 +205,4 @@ require_once("block/FallableBlock.php");
require_once("block/LiquidBlock.php");
require_once("block/StairBlock.php");
require_once("block/DoorBlock.php");
/***REM_END***/

View File

@ -25,8 +25,6 @@ the Free Software Foundation, either version 3 of the License, or
*/
require_once("classes/material/IDs.php");
class Item{
public static $class = array(
SUGARCANE => "SugarcaneItem",

Some files were not shown because too many files have changed in this diff Show More