mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-10 21:45:35 +00:00
Improved Level object deallocation
This commit is contained in:
parent
f2b573c32f
commit
2f8267aa1e
@ -2291,6 +2291,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
|||||||
$this->windowIndex = [];
|
$this->windowIndex = [];
|
||||||
$this->usedChunks = [];
|
$this->usedChunks = [];
|
||||||
$this->loadQueue = [];
|
$this->loadQueue = [];
|
||||||
|
$this->spawnPosition = null;
|
||||||
unset($this->buffer);
|
unset($this->buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1189,6 +1189,7 @@ abstract class Entity extends Location implements Metadatable{
|
|||||||
$level->removeEntity($this);
|
$level->removeEntity($this);
|
||||||
}
|
}
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
|
$this->level = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -304,6 +304,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function close(){
|
public function close(){
|
||||||
|
|
||||||
if($this->getAutoSave()){
|
if($this->getAutoSave()){
|
||||||
$this->save();
|
$this->save();
|
||||||
}
|
}
|
||||||
@ -316,6 +317,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$this->provider->close();
|
$this->provider->close();
|
||||||
$this->provider = null;
|
$this->provider = null;
|
||||||
$this->blockMetadata = null;
|
$this->blockMetadata = null;
|
||||||
|
$this->blockCache = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -294,6 +294,7 @@ abstract class BaseFullChunk implements FullChunk{
|
|||||||
foreach($this->getTiles() as $tile){
|
foreach($this->getTiles() as $tile){
|
||||||
$tile->close();
|
$tile->close();
|
||||||
}
|
}
|
||||||
|
$this->provider = null;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,9 +191,7 @@ class McRegion extends BaseLevelProvider{
|
|||||||
public function unloadChunk($x, $z, $safe = true){
|
public function unloadChunk($x, $z, $safe = true){
|
||||||
$chunk = $this->getChunk($x, $z, false);
|
$chunk = $this->getChunk($x, $z, false);
|
||||||
if($chunk instanceof FullChunk and $chunk->unload(false, $safe)){
|
if($chunk instanceof FullChunk and $chunk->unload(false, $safe)){
|
||||||
$this->chunks[$index = Level::chunkHash($x, $z)] = null;
|
unset($this->chunks[Level::chunkHash($x, $z)]);
|
||||||
|
|
||||||
unset($this->chunks[$index]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -121,6 +121,7 @@ abstract class Tile extends Position{
|
|||||||
if(($level = $this->getLevel()) instanceof Level){
|
if(($level = $this->getLevel()) instanceof Level){
|
||||||
$level->removeTile($this);
|
$level->removeTile($this);
|
||||||
}
|
}
|
||||||
|
$this->level = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user