mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-11 04:17:48 +00:00
Level: change some stupid var names
This commit is contained in:
parent
636cc1c199
commit
5bf7350ee5
@ -694,25 +694,25 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function registerChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad = true){
|
public function registerChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad = true){
|
||||||
$hash = $loader->getLoaderId();
|
$loaderId = $loader->getLoaderId();
|
||||||
|
|
||||||
if(!isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)])){
|
if(!isset($this->chunkLoaders[$chunkHash = Level::chunkHash($chunkX, $chunkZ)])){
|
||||||
$this->chunkLoaders[$index] = [];
|
$this->chunkLoaders[$chunkHash] = [];
|
||||||
$this->playerLoaders[$index] = [];
|
$this->playerLoaders[$chunkHash] = [];
|
||||||
}elseif(isset($this->chunkLoaders[$index][$hash])){
|
}elseif(isset($this->chunkLoaders[$chunkHash][$loaderId])){
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->chunkLoaders[$index][$hash] = $loader;
|
$this->chunkLoaders[$chunkHash][$loaderId] = $loader;
|
||||||
if($loader instanceof Player){
|
if($loader instanceof Player){
|
||||||
$this->playerLoaders[$index][$hash] = $loader;
|
$this->playerLoaders[$chunkHash][$loaderId] = $loader;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($this->loaders[$hash])){
|
if(!isset($this->loaders[$loaderId])){
|
||||||
$this->loaderCounter[$hash] = 1;
|
$this->loaderCounter[$loaderId] = 1;
|
||||||
$this->loaders[$hash] = $loader;
|
$this->loaders[$loaderId] = $loader;
|
||||||
}else{
|
}else{
|
||||||
++$this->loaderCounter[$hash];
|
++$this->loaderCounter[$loaderId];
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->cancelUnloadChunkRequest($chunkX, $chunkZ);
|
$this->cancelUnloadChunkRequest($chunkX, $chunkZ);
|
||||||
@ -723,20 +723,20 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function unregisterChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ){
|
public function unregisterChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ){
|
||||||
$index = Level::chunkHash($chunkX, $chunkZ);
|
$chunkHash = Level::chunkHash($chunkX, $chunkZ);
|
||||||
$hash = $loader->getLoaderId();
|
$loaderId = $loader->getLoaderId();
|
||||||
if(isset($this->chunkLoaders[$index][$hash])){
|
if(isset($this->chunkLoaders[$chunkHash][$loaderId])){
|
||||||
unset($this->chunkLoaders[$index][$hash]);
|
unset($this->chunkLoaders[$chunkHash][$loaderId]);
|
||||||
unset($this->playerLoaders[$index][$hash]);
|
unset($this->playerLoaders[$chunkHash][$loaderId]);
|
||||||
if(count($this->chunkLoaders[$index]) === 0){
|
if(count($this->chunkLoaders[$chunkHash]) === 0){
|
||||||
unset($this->chunkLoaders[$index]);
|
unset($this->chunkLoaders[$chunkHash]);
|
||||||
unset($this->playerLoaders[$index]);
|
unset($this->playerLoaders[$chunkHash]);
|
||||||
$this->unloadChunkRequest($chunkX, $chunkZ, true);
|
$this->unloadChunkRequest($chunkX, $chunkZ, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(--$this->loaderCounter[$hash] === 0){
|
if(--$this->loaderCounter[$loaderId] === 0){
|
||||||
unset($this->loaderCounter[$hash]);
|
unset($this->loaderCounter[$loaderId]);
|
||||||
unset($this->loaders[$hash]);
|
unset($this->loaders[$loaderId]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user