fixed worldconfig parsing
This commit is contained in:
parent
762772a079
commit
8cd5d9f7d0
@ -44,15 +44,18 @@ class SimpleSpawnComponent implements SpawnComponent, Listener {
|
||||
print "WorldLoadSuccessEvent!";
|
||||
if ($event->getArena() !== $this->arena)
|
||||
return;
|
||||
$this->spawns = UtilArray::getValuesRecursively($this->worldComponent->getTeams());
|
||||
|
||||
foreach ($this->spawns as $key => $value)
|
||||
{
|
||||
if (!($value instanceof Position))
|
||||
unset($this->spawns[$key]);
|
||||
}
|
||||
$this->spawns = $this->worldComponent->getTeams()['Green'];
|
||||
|
||||
print (count($this->spawns) . " spawns Loaded\n");
|
||||
// $this->spawns = UtilArray::getValuesRecursively($this->worldComponent->getTeams());
|
||||
//
|
||||
// foreach ($this->spawns as $key => $value)
|
||||
// {
|
||||
// if (!($value instanceof Position))
|
||||
// unset($this->spawns[$key]);
|
||||
// }
|
||||
//
|
||||
// print (count($this->spawns) . " spawns Loaded\n");
|
||||
|
||||
}
|
||||
|
||||
@ -80,12 +83,9 @@ class SimpleSpawnComponent implements SpawnComponent, Listener {
|
||||
Main::sendLoc($player);
|
||||
|
||||
$pos = $this->spawns[array_rand($this->spawns)];
|
||||
$pos = $pos->getLevel()->getSpawnLocation();
|
||||
//$pos = $pos->getLevel()->getSpawnLocation();
|
||||
|
||||
print "\nX: " . $pos->getX();
|
||||
print "\nY: " . $pos->getY();
|
||||
print "\nZ: " . $pos->getZ();
|
||||
print "\nLevel: " . $pos->getLevel()->getName();
|
||||
print_r($pos);
|
||||
|
||||
$player->teleport($pos);
|
||||
|
||||
|
@ -145,7 +145,7 @@ class WorldComponent implements Listener
|
||||
|
||||
public function loadWorldData()
|
||||
{
|
||||
$handle = fopen("WorldConfig.dat", "r");
|
||||
$handle = fopen('worlds/' . $this->worldNameFolder . '/WorldConfig.dat', "r");
|
||||
if ($handle)
|
||||
{
|
||||
//These store the array that data should be inserted into
|
||||
@ -155,7 +155,9 @@ class WorldComponent implements Listener
|
||||
|
||||
while (($line = fgets($handle)) !== false)
|
||||
{
|
||||
$tokens = explode(":", $line);
|
||||
$trimmedLine = trim($line, "\n\r");
|
||||
|
||||
$tokens = explode(":", $trimmedLine);
|
||||
|
||||
if (count($tokens) < 2 || strlen($tokens[0]) == 0)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user