* More ??

* fix undefined variable
This commit is contained in:
Dylan K. Taylor
2016-11-30 10:07:37 +00:00
committed by GitHub
parent 43a36dba40
commit d6629d6843
15 changed files with 23 additions and 24 deletions

View File

@ -62,6 +62,6 @@ abstract class LevelProviderManager{
public static function getProviderByName($name){
$name = trim(strtolower($name));
return isset(self::$providers[$name]) ? self::$providers[$name] : null;
return self::$providers[$name] ?? null;
}
}

View File

@ -117,7 +117,7 @@ class Anvil extends McRegion{
* @return RegionLoader
*/
protected function getRegion($x, $z){
return isset($this->regions[$index = Level::chunkHash($x, $z)]) ? $this->regions[$index] : null;
return $this->regions[Level::chunkHash($x, $z)] ?? null;
}
/**

View File

@ -355,8 +355,7 @@ abstract class BaseFullChunk implements FullChunk{
}
public function getTile($x, $y, $z){
$index = ($z << 12) | ($x << 8) | $y;
return isset($this->tileList[$index]) ? $this->tileList[$index] : null;
return $this->tileList[($z << 12) | ($x << 8) | $y] ?? null;
}
public function isLoaded(){

View File

@ -220,7 +220,7 @@ class McRegion extends BaseLevelProvider{
}
public function unloadChunk($x, $z, $safe = true){
$chunk = isset($this->chunks[$index = Level::chunkHash($x, $z)]) ? $this->chunks[$index] : null;
$chunk = $this->chunks[$index = Level::chunkHash($x, $z)] ?? null;
if($chunk instanceof FullChunk and $chunk->unload(false, $safe)){
unset($this->chunks[$index]);
return true;
@ -246,7 +246,7 @@ class McRegion extends BaseLevelProvider{
* @return RegionLoader
*/
protected function getRegion($x, $z){
return isset($this->regions[$index = Level::chunkHash($x, $z)]) ? $this->regions[$index] : null;
return $this->regions[Level::chunkHash($x, $z)] ?? null;
}
/**