Clean up some old code

This commit is contained in:
Dylan K. Taylor 2016-11-04 21:46:14 +00:00
parent 557257baed
commit c494af618c

View File

@ -750,56 +750,6 @@ class Server{
$nbt->Motion->setTagType(NBT::TAG_Double);
$nbt->Rotation->setTagType(NBT::TAG_Float);
if(file_exists($path . "$name.yml")){ //Importing old PocketMine-MP files
$data = new Config($path . "$name.yml", Config::YAML, []);
$nbt["playerGameType"] = (int) $data->get("gamemode");
$nbt["Level"] = $data->get("position")["level"];
$nbt["Pos"][0] = $data->get("position")["x"];
$nbt["Pos"][1] = $data->get("position")["y"];
$nbt["Pos"][2] = $data->get("position")["z"];
$nbt["SpawnLevel"] = $data->get("spawn")["level"];
$nbt["SpawnX"] = (int) $data->get("spawn")["x"];
$nbt["SpawnY"] = (int) $data->get("spawn")["y"];
$nbt["SpawnZ"] = (int) $data->get("spawn")["z"];
$this->logger->notice($this->getLanguage()->translateString("pocketmine.data.playerOld", [$name]));
foreach($data->get("inventory") as $slot => $item){
if(count($item) === 3){
$nbt->Inventory[$slot + 9] = new CompoundTag("", [
new ShortTag("id", $item[0]),
new ShortTag("Damage", $item[1]),
new ByteTag("Count", $item[2]),
new ByteTag("Slot", $slot + 9),
new ByteTag("TrueSlot", $slot + 9)
]);
}
}
foreach($data->get("hotbar") as $slot => $itemSlot){
if(isset($nbt->Inventory[$itemSlot + 9])){
$item = $nbt->Inventory[$itemSlot + 9];
$nbt->Inventory[$slot] = new CompoundTag("", [
new ShortTag("id", $item["id"]),
new ShortTag("Damage", $item["Damage"]),
new ByteTag("Count", $item["Count"]),
new ByteTag("Slot", $slot),
new ByteTag("TrueSlot", $item["TrueSlot"])
]);
}
}
foreach($data->get("armor") as $slot => $item){
if(count($item) === 2){
$nbt->Inventory[$slot + 100] = new CompoundTag("", [
new ShortTag("id", $item[0]),
new ShortTag("Damage", $item[1]),
new ByteTag("Count", 1),
new ByteTag("Slot", $slot + 100)
]);
}
}
foreach($data->get("achievements") as $achievement => $status){
$nbt->Achievements[$achievement] = new ByteTag($achievement, $status == true ? 1 : 0);
}
unlink($path . "$name.yml");
}
$this->saveOfflinePlayerData($name, $nbt);
return $nbt;
@ -1025,10 +975,6 @@ class Server{
return false;
}
//$entities = new Config($path."entities.yml", Config::YAML);
//if(file_exists($path . "tileEntities.yml")){
// @rename($path . "tileEntities.yml", $path . "tiles.yml");
//}
try{
$level = new Level($this, $name, $path, $provider);
@ -1142,14 +1088,6 @@ class Server{
if(LevelProviderManager::getProvider($path) === null){
return false;
}
/*if(file_exists($path)){
$level = new LevelImport($path);
if($level->import() === false){ //Try importing a world
return false;
}
}else{
return false;
}*/
}
return true;