This commit is contained in:
Shoghi Cervantes 2014-02-19 17:41:12 +01:00
parent be13d0a921
commit 7bdc48509e
14 changed files with 123 additions and 198 deletions

View File

@ -38,10 +38,10 @@ class BanAPI{
} }
public function init(){ public function init(){
$this->whitelist = new Config(DATA_PATH."white-list.txt", CONFIG_LIST);//Open whitelist list file $this->whitelist = new Config(DATA_PATH."white-list.txt", Config::LIST);//Open whitelist list file
$this->bannedIPs = new Config(DATA_PATH."banned-ips.txt", CONFIG_LIST);//Open Banned IPs list file $this->bannedIPs = new Config(DATA_PATH."banned-ips.txt", Config::LIST);//Open Banned IPs list file
$this->banned = new Config(DATA_PATH."banned.txt", CONFIG_LIST);//Open Banned Usernames list file $this->banned = new Config(DATA_PATH."banned.txt", Config::LIST);//Open Banned Usernames list file
$this->ops = new Config(DATA_PATH."ops.txt", CONFIG_LIST);//Open list of OPs $this->ops = new Config(DATA_PATH."ops.txt", Config::LIST);//Open list of OPs
$this->server->api->console->register("banip", "<add|remove|list|reload> [IP|player]", array($this, "commandHandler")); $this->server->api->console->register("banip", "<add|remove|list|reload> [IP|player]", array($this, "commandHandler"));
$this->server->api->console->register("ban", "<add|remove|list|reload> [username]", array($this, "commandHandler")); $this->server->api->console->register("ban", "<add|remove|list|reload> [username]", array($this, "commandHandler"));
$this->server->api->console->register("kick", "<player> [reason ...]", array($this, "commandHandler")); $this->server->api->console->register("kick", "<player> [reason ...]", array($this, "commandHandler"));
@ -211,7 +211,7 @@ class BanAPI{
$output .= "Player \"$user\" added to white-list\n"; $output .= "Player \"$user\" added to white-list\n";
break; break;
case "reload": case "reload":
$this->whitelist = new Config(DATA_PATH."white-list.txt", CONFIG_LIST); $this->whitelist = new Config(DATA_PATH."white-list.txt", Config::LIST);
break; break;
case "list": case "list":
$output .= "White-list: ".implode(", ", $this->whitelist->getAll(true))."\n"; $output .= "White-list: ".implode(", ", $this->whitelist->getAll(true))."\n";
@ -256,7 +256,7 @@ class BanAPI{
$output .= "IP \"$ip\" added to ban list\n"; $output .= "IP \"$ip\" added to ban list\n";
break; break;
case "reload": case "reload":
$this->bannedIPs = new Config(DATA_PATH."banned-ips.txt", CONFIG_LIST); $this->bannedIPs = new Config(DATA_PATH."banned-ips.txt", Config::LIST);
break; break;
case "list": case "list":
$output .= "IP ban list: ".implode(", ", $this->bannedIPs->getAll(true))."\n"; $output .= "IP ban list: ".implode(", ", $this->bannedIPs->getAll(true))."\n";
@ -294,7 +294,7 @@ class BanAPI{
$output .= "Player \"$user\" added to ban list\n"; $output .= "Player \"$user\" added to ban list\n";
break; break;
case "reload": case "reload":
$this->banned = new Config(DATA_PATH."banned.txt", CONFIG_LIST); $this->banned = new Config(DATA_PATH."banned.txt", Config::LIST);
break; break;
case "list": case "list":
$output .= "Ban list: ".implode(", ", $this->banned->getAll(true))."\n"; $output .= "Ban list: ".implode(", ", $this->banned->getAll(true))."\n";

View File

@ -155,12 +155,12 @@ class LevelAPI{
console("[ERROR] Could not load level \"".$name."\""); console("[ERROR] Could not load level \"".$name."\"");
return false; return false;
} }
$entities = new Config($path."entities.yml", CONFIG_YAML); $entities = new Config($path."entities.yml", Config::YAML);
if(file_exists($path."tileEntities.yml")){ if(file_exists($path."tileEntities.yml")){
@rename($path."tileEntities.yml", $path."tiles.yml"); @rename($path."tileEntities.yml", $path."tiles.yml");
} }
$tiles = new Config($path."tiles.yml", CONFIG_YAML); $tiles = new Config($path."tiles.yml", Config::YAML);
$blockUpdates = new Config($path."bupdates.yml", CONFIG_YAML); $blockUpdates = new Config($path."bupdates.yml", Config::YAML);
$this->levels[$name] = new Level($level, $entities, $tiles, $blockUpdates, $name); $this->levels[$name] = new Level($level, $entities, $tiles, $blockUpdates, $name);
foreach($entities->getAll() as $entity){ foreach($entities->getAll() as $entity){
if(!isset($entity["id"])){ if(!isset($entity["id"])){

View File

@ -502,10 +502,10 @@ class PlayerAPI{
if(!file_exists(DATA_PATH."players/".$iname.".yml")){ if(!file_exists(DATA_PATH."players/".$iname.".yml")){
console("[NOTICE] Player data not found for \"".$iname."\", creating new profile"); console("[NOTICE] Player data not found for \"".$iname."\", creating new profile");
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default); $data = new Config(DATA_PATH."players/".$iname.".yml", Config::YAML, $default);
$data->save(); $data->save();
}else{ }else{
$data = new Config(DATA_PATH."players/".$iname.".yml", CONFIG_YAML, $default); $data = new Config(DATA_PATH."players/".$iname.".yml", Config::YAML, $default);
} }
if(($data->get("gamemode") & 0x01) === 1){ if(($data->get("gamemode") & 0x01) === 1){

View File

@ -191,7 +191,7 @@ class PluginAPI extends stdClass{
return false; return false;
} }
$path = $this->configPath($plugin); $path = $this->configPath($plugin);
$cnf = new Config($path."config.yml", CONFIG_YAML, $default); $cnf = new Config($path."config.yml", Config::YAML, $default);
$cnf->save(); $cnf->save();
return $path; return $path;
} }

View File

@ -110,7 +110,7 @@ class ServerAPI{
console("[INFO] Starting Minecraft PE server version ".FORMAT_AQUA.CURRENT_MINECRAFT_VERSION); console("[INFO] Starting Minecraft PE server version ".FORMAT_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(
"server-name" => "Minecraft: PE Server", "server-name" => "Minecraft: PE Server",
"description" => "Server made using PocketMine-MP", "description" => "Server made using PocketMine-MP",
"motd" => "Welcome @player to this server!", "motd" => "Welcome @player to this server!",

View File

@ -2426,22 +2426,6 @@ class Player{
$this->bufferLen += 6 + $len; $this->bufferLen += 6 + $len;
return array(); return array();
} }
public function isPermissionSet($nodeName){
}
public function hasPermission($nodeName){
return $this->isPermissionSet($nodeName) and PermissionsAPI::hasPermission($nodeName, $this);
}
public function setPermission($nodeName, $boolean){
}
public function unsetPermission($nodeName, $boolean){
}
/** /**
* @return string * @return string

36
src/nbt/NBT.php Normal file
View File

@ -0,0 +1,36 @@
<?php
/**
*
* ____ _ _ __ __ _ __ __ ____
* | _ \ ___ ___| | _____| |_| \/ (_)_ __ ___ | \/ | _ \
* | |_) / _ \ / __| |/ / _ \ __| |\/| | | '_ \ / _ \_____| |\/| | |_) |
* | __/ (_) | (__| < __/ |_| | | | | | | | __/_____| | | | __/
* |_| \___/ \___|_|\_\___|\__|_| |_|_|_| |_|\___| |_| |_|_|
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* @author PocketMine Team
* @link http://www.pocketmine.net/
*
*
*/
class NBT{
const MODE_WRITE = 0;
const MODE_OVERWRITE = 1;
const LITTLE_ENDIAN = 0;
const BIG_ENDIAN = 1;
private $buffer;
private $offset;
private $mode = NBT::MODE_WRITE;
public function __construct($buffer, $endianness = NBT::BIG_ENDIAN){
}
}

View File

@ -98,11 +98,11 @@ class PMFLevel extends PMF{
$this->saveData(); $this->saveData();
@mkdir(dirname($this->file)."/chunks/", 0755); @mkdir(dirname($this->file)."/chunks/", 0755);
if(!file_exists(dirname($this->file)."/entities.yml")){ if(!file_exists(dirname($this->file)."/entities.yml")){
$entities = new Config(dirname($this->file)."/entities.yml", CONFIG_YAML); $entities = new Config(dirname($this->file)."/entities.yml", Config::YAML);
$entities->save(); $entities->save();
} }
if(!file_exists(dirname($this->file)."/tiles.yml")){ if(!file_exists(dirname($this->file)."/tiles.yml")){
$tiles = new Config(dirname($this->file)."/tiles.yml", CONFIG_YAML); $tiles = new Config(dirname($this->file)."/tiles.yml", Config::YAML);
$tiles->save(); $tiles->save();
} }
} }

View File

@ -19,14 +19,7 @@
* *
*/ */
define("CONFIG_DETECT", -1); //Detect by file extension
define("CONFIG_PROPERTIES", 0); // .properties
define("CONFIG_CNF", CONFIG_PROPERTIES); // .cnf
define("CONFIG_JSON", 1); // .js, .json
define("CONFIG_YAML", 2); // .yml, .yaml
//define("CONFIG_EXPORT", 3); // .export, .xport
define("CONFIG_SERIALIZED", 4); // .sl
define("CONFIG_LIST", 5); // .txt, .list
/** /**
* Class Config * Class Config
@ -34,6 +27,15 @@ define("CONFIG_LIST", 5); // .txt, .list
* Config Class for simple config manipulation of multiple formats. * Config Class for simple config manipulation of multiple formats.
*/ */
class Config{ class Config{
const DETECT = -1; //Detect by file extension
const PROPERTIES = 0; // .properties
const CNF = PROPERTIES; // .cnf
const JSON = 1; // .js, .json
const YAML = 2; // .yml, .yaml
//const EXPORT = 3; // .export, .xport
const SERIALIZED = 4; // .sl
const LIST = 5; // .txt, .list
/** /**
* @var array * @var array
*/ */
@ -49,23 +51,23 @@ class Config{
/** /**
* @var integer * @var integer
*/ */
private $type = CONFIG_DETECT; private $type = Config::DETECT;
public static $formats = array( public static $formats = array(
"properties" => CONFIG_PROPERTIES, "properties" => Config::PROPERTIES,
"cnf" => CONFIG_CNF, "cnf" => Config::CNF,
"conf" => CONFIG_CNF, "conf" => Config::CNF,
"config" => CONFIG_CNF, "config" => Config::CNF,
"json" => CONFIG_JSON, "json" => Config::JSON,
"js" => CONFIG_JSON, "js" => Config::JSON,
"yml" => CONFIG_YAML, "yml" => Config::YAML,
"yaml" => CONFIG_YAML, "yaml" => Config::YAML,
//"export" => CONFIG_EXPORT, //"export" => Config::EXPORT,
//"xport" => CONFIG_EXPORT, //"xport" => Config::EXPORT,
"sl" => CONFIG_SERIALIZED, "sl" => Config::SERIALIZED,
"serialize" => CONFIG_SERIALIZED, "serialize" => Config::SERIALIZED,
"txt" => CONFIG_LIST, "txt" => Config::LIST,
"list" => CONFIG_LIST, "list" => Config::LIST,
); );
/** /**
@ -74,8 +76,9 @@ class Config{
* @param array $default * @param array $default
* @param null|boolean $correct * @param null|boolean $correct
*/ */
public function __construct($file, $type = CONFIG_DETECT, $default = array(), &$correct = null){ public function __construct($file, $type = Config::DETECT, $default = array(), &$correct = null){
$this->load($file, $type, $default); $this->load($file, $type, $default);
$correct = $this->correct;
} }
public function reload(){ public function reload(){
@ -96,7 +99,7 @@ class Config{
* *
* @return boolean * @return boolean
*/ */
public function load($file, $type = CONFIG_DETECT, $default = array()){ public function load($file, $type = Config::DETECT, $default = array()){
$this->correct = true; $this->correct = true;
$this->type = (int) $type; $this->type = (int) $type;
$this->file = $file; $this->file = $file;
@ -107,7 +110,7 @@ class Config{
$this->config = $default; $this->config = $default;
$this->save(); $this->save();
}else{ }else{
if($this->type === CONFIG_DETECT){ if($this->type === Config::DETECT){
$extension = explode(".", basename($this->file)); $extension = explode(".", basename($this->file));
$extension = strtolower(trim(array_pop($extension))); $extension = strtolower(trim(array_pop($extension)));
if(isset(Config::$formats[$extension])){ if(isset(Config::$formats[$extension])){
@ -119,21 +122,21 @@ class Config{
if($this->correct === true){ if($this->correct === true){
$content = @file_get_contents($this->file); $content = @file_get_contents($this->file);
switch($this->type){ switch($this->type){
case CONFIG_PROPERTIES: case Config::PROPERTIES:
case CONFIG_CNF: case Config::CNF:
$this->parseProperties($content); $this->parseProperties($content);
break; break;
case CONFIG_JSON: case Config::JSON:
$this->config = @json_decode($content, true); $this->config = @json_decode($content, true);
break; break;
case CONFIG_YAML: case Config::YAML:
$content = $this->fixYAMLIndexes($content); $content = $this->fixYAMLIndexes($content);
$this->config = yaml_parse($content); $this->config = yaml_parse($content);
break; break;
case CONFIG_SERIALIZED: case Config::SERIALIZED:
$this->config = @unserialize($content); $this->config = @unserialize($content);
break; break;
case CONFIG_LIST: case Config::LIST:
$this->parseList($content); $this->parseList($content);
break; break;
default: default:
@ -166,20 +169,20 @@ class Config{
public function save(){ public function save(){
if($this->correct === true){ if($this->correct === true){
switch($this->type){ switch($this->type){
case CONFIG_PROPERTIES: case Config::PROPERTIES:
case CONFIG_CNF: case Config::CNF:
$content = $this->writeProperties(); $content = $this->writeProperties();
break; break;
case CONFIG_JSON: case Config::JSON:
$content = json_encode($this->config, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING); $content = json_encode($this->config, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING);
break; break;
case CONFIG_YAML: case Config::YAML:
$content = yaml_emit($this->config, YAML_UTF8_ENCODING); $content = yaml_emit($this->config, YAML_UTF8_ENCODING);
break; break;
case CONFIG_SERIALIZED: case Config::SERIALIZED:
$content = @serialize($this->config); $content = @serialize($this->config);
break; break;
case CONFIG_LIST: case Config::LIST:
$content = implode("\r\n", array_keys($this->config)); $content = implode("\r\n", array_keys($this->config));
break; break;
} }

View File

@ -19,7 +19,7 @@
* *
*/ */
class NBT{ class NBTOld{
public $tree = array(); public $tree = array();
public $binary = b""; public $binary = b"";
private $offset = 0; private $offset = 0;

View File

@ -82,7 +82,7 @@ LICENSE;
} }
private function generateBaseConfig(){ private function generateBaseConfig(){
$config = new Config(DATA_PATH . "server.properties", CONFIG_PROPERTIES); $config = new Config(DATA_PATH . "server.properties", Config::PROPERTIES);
echo "[?] ".$this->lang->name_your_server." (".self::DEFAULT_NAME."): "; echo "[?] ".$this->lang->name_your_server." (".self::DEFAULT_NAME."): ";
$config->set("server-name", $this->getInput(self::DEFAULT_NAME)); $config->set("server-name", $this->getInput(self::DEFAULT_NAME));
echo "[*] ".$this->lang->port_warning."\n"; echo "[*] ".$this->lang->port_warning."\n";
@ -122,13 +122,13 @@ LICENSE;
if($op === ""){ if($op === ""){
echo "[!] ".$this->lang->op_warning."\n"; echo "[!] ".$this->lang->op_warning."\n";
}else{ }else{
$ops = new Config(DATA_PATH."ops.txt", CONFIG_LIST); $ops = new Config(DATA_PATH."ops.txt", Config::LIST);
$ops->set($op, true); $ops->set($op, true);
$ops->save(); $ops->save();
} }
echo "[*] ".$this->lang->whitelist_info."\n"; echo "[*] ".$this->lang->whitelist_info."\n";
echo "[?] ".$this->lang->whitelist_enable." (y/N): "; echo "[?] ".$this->lang->whitelist_enable." (y/N): ";
$config = new Config(DATA_PATH . "server.properties", CONFIG_PROPERTIES); $config = new Config(DATA_PATH . "server.properties", Config::PROPERTIES);
if(strtolower($this->getInput("n")) === "y"){ if(strtolower($this->getInput("n")) === "y"){
echo "[!] ".$this->lang->whitelist_warning."\n"; echo "[!] ".$this->lang->whitelist_warning."\n";
$config->set("white-list", true); $config->set("white-list", true);
@ -139,7 +139,7 @@ LICENSE;
} }
private function networkFunctions(){ private function networkFunctions(){
$config = new Config(DATA_PATH . "server.properties", CONFIG_PROPERTIES); $config = new Config(DATA_PATH . "server.properties", Config::PROPERTIES);
echo "[!] ".$this->lang->query_warning1."\n"; echo "[!] ".$this->lang->query_warning1."\n";
echo "[!] ".$this->lang->query_warning2."\n"; echo "[!] ".$this->lang->query_warning2."\n";
echo "[?] ".$this->lang->query_disable." (y/N): "; echo "[?] ".$this->lang->query_disable." (y/N): ";

View File

@ -20,16 +20,25 @@
*/ */
class Level{ class Level{
public $entities, $tiles, $blockUpdates, $nextSave, $players = array(), $level; public $entities = array();
public $chunkEntities = array();
public $tiles = array();
public $entitiesConfig;
public $tilesConfig;
public $blockUpdatesConfig;
public $nextSave, $players = array(), $level;
private $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount, $stopTime, $generator; private $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount, $stopTime, $generator;
public function __construct(PMFLevel $level, Config $entities, Config $tiles, Config $blockUpdates, $name){ public function __construct(PMFLevel $level, Config $entities, Config $tiles, Config $blockUpdates, $name){
$this->server = ServerAPI::request(); $this->server = ServerAPI::request();
$this->level = $level; $this->level = $level;
$this->level->level = $this; $this->level->level = $this;
$this->entities = $entities; $this->entitiesConfig = $entities;
$this->tiles = $tiles; $this->tilesConfig = $tiles;
$this->blockUpdates = $blockUpdates; $this->blockUpdatesConfig = $blockUpdates;
$this->startTime = $this->time = (int) $this->level->getData("time"); $this->startTime = $this->time = (int) $this->level->getData("time");
$this->nextSave = $this->startCheck = microtime(true); $this->nextSave = $this->startCheck = microtime(true);
$this->nextSave += 90; $this->nextSave += 90;
@ -58,10 +67,11 @@ class Level{
} }
public function useChunk($X, $Z, Player $player){ public function useChunk($X, $Z, Player $player){
if(!isset($this->usedChunks[$X.".".$Z])){ $index = PMFLevel::getIndex($X, $Z);
$this->usedChunks[$X.".".$Z] = array(); if(!isset($this->usedChunks[$index])){
$this->usedChunks[$index] = array();
} }
$this->usedChunks[$X.".".$Z][$player->CID] = true; $this->usedChunks[$index][$player->CID] = true;
if(isset($this->level)){ if(isset($this->level)){
$this->level->loadChunk($X, $Z); $this->level->loadChunk($X, $Z);
} }
@ -74,7 +84,7 @@ class Level{
} }
public function freeChunk($X, $Z, Player $player){ public function freeChunk($X, $Z, Player $player){
unset($this->usedChunks[$X.".".$Z][$player->CID]); unset($this->usedChunks[PMFLevel::getIndex($X, $Z)][$player->CID]);
} }
public function isChunkPopulated($X, $Z){ public function isChunkPopulated($X, $Z){
@ -183,115 +193,7 @@ class Level{
} }
if($extra !== false){ if($extra !== false){
$entities = array();
foreach($this->server->api->entity->getAll($this) as $entity){
if($entity->class === ENTITY_MOB){
$entities[] = array(
"id" => $entity->type,
"Color" => @$entity->data["Color"],
"Sheared" => @$entity->data["Sheared"],
"Health" => $entity->health,
"Pos" => array(
0 => $entity->x,
1 => $entity->y,
2 => $entity->z,
),
"Rotation" => array(
0 => $entity->yaw,
1 => $entity->pitch,
),
);
}elseif($entity->class === ENTITY_OBJECT){
if($entity->type === OBJECT_PAINTING){
$entities[] = array(
"id" => $entity->type,
"TileX" => $entity->x,
"TileY" => $entity->y,
"TileZ" => $entity->z,
"Health" => $entity->health,
"Motive" => $entity->data["Motive"],
"Pos" => array(
0 => $entity->x,
1 => $entity->y,
2 => $entity->z,
),
"Rotation" => array(
0 => $entity->yaw,
1 => $entity->pitch,
),
);
}else{
$entities[] = array(
"id" => $entity->type,
"Health" => $entity->health,
"Pos" => array(
0 => $entity->x,
1 => $entity->y,
2 => $entity->z,
),
"Rotation" => array(
0 => $entity->yaw,
1 => $entity->pitch,
),
);
}
}elseif($entity->class === ENTITY_FALLING){
$entities[] = array(
"id" => $entity->type,
"Health" => $entity->health,
"Tile" => $entity->data["Tile"],
"Pos" => array(
0 => $entity->x,
1 => $entity->y,
2 => $entity->z,
),
"Rotation" => array(
0 => 0,
1 => 0,
),
);
}elseif($entity->class === ENTITY_ITEM){
$entities[] = array(
"id" => 64,
"Item" => array(
"id" => $entity->type,
"Damage" => $entity->meta,
"Count" => $entity->stack,
),
"Health" => $entity->health,
"Pos" => array(
0 => $entity->x,
1 => $entity->y,
2 => $entity->z,
),
"Rotation" => array(
0 => 0,
1 => 0,
),
);
}
}
$this->entities->setAll($entities);
$this->entities->save();
$tiles = array();
foreach($this->server->api->tile->getAll($this) as $tile){
$tiles[] = $tile->data;
}
$this->tiles->setAll($tiles);
$this->tiles->save();
$blockUpdates = array();
$updates = $this->server->query("SELECT x,y,z,type,delay FROM blockUpdates WHERE level = '".$this->getName()."';");
if($updates !== false and $updates !== true){
$timeu = microtime(true);
while(($bupdate = $updates->fetchArray(SQLITE3_ASSOC)) !== false){
$bupdate["delay"] = max(1, ($bupdate["delay"] - $timeu) * 20);
$blockUpdates[] = $bupdate;
}
}
$this->blockUpdates->setAll($blockUpdates);
$this->blockUpdates->save();
} }

View File

@ -29,9 +29,9 @@ class LevelImport{
if(file_exists($this->path."tileEntities.dat")){ //OldPM if(file_exists($this->path."tileEntities.dat")){ //OldPM
$level = unserialize(file_get_contents($this->path."level.dat")); $level = unserialize(file_get_contents($this->path."level.dat"));
console("[INFO] Importing OldPM level \"".$level["LevelName"]."\" to PMF format"); console("[INFO] Importing OldPM level \"".$level["LevelName"]."\" to PMF format");
$entities = new Config($this->path."entities.yml", CONFIG_YAML, unserialize(file_get_contents($this->path."entities.dat"))); $entities = new Config($this->path."entities.yml", Config::YAML, unserialize(file_get_contents($this->path."entities.dat")));
$entities->save(); $entities->save();
$tiles = new Config($this->path."tiles.yml", CONFIG_YAML, unserialize(file_get_contents($this->path."tileEntities.dat"))); $tiles = new Config($this->path."tiles.yml", Config::YAML, unserialize(file_get_contents($this->path."tileEntities.dat")));
$tiles->save(); $tiles->save();
}elseif(file_exists($this->path."chunks.dat") and file_exists($this->path."level.dat")){ //Pocket }elseif(file_exists($this->path."chunks.dat") and file_exists($this->path."level.dat")){ //Pocket
$nbt = new NBT(); $nbt = new NBT();
@ -49,9 +49,9 @@ 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();
}else{ }else{
return false; return false;

View File

@ -39,9 +39,9 @@ class WorldGenerator{
"generatorSettings" => $this->generator->getSettings(), "generatorSettings" => $this->generator->getSettings(),
"extra" => "" "extra" => ""
)); ));
$entities = new Config($this->path."entities.yml", CONFIG_YAML); $entities = new Config($this->path."entities.yml", Config::YAML);
$tiles = new Config($this->path."tiles.yml", CONFIG_YAML); $tiles = new Config($this->path."tiles.yml", Config::YAML);
$blockUpdates = new Config($this->path."bupdates.yml", CONFIG_YAML); $blockUpdates = new Config($this->path."bupdates.yml", Config::YAML);
$this->level = new Level($level, $entities, $tiles, $blockUpdates, $name); $this->level = new Level($level, $entities, $tiles, $blockUpdates, $name);
} }