mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-13 06:55:29 +00:00
Address several LevelDB related crashdumps in the crash archive
This commit is contained in:
parent
120cf56a47
commit
23752548fe
@ -634,7 +634,7 @@ class Chunk{
|
|||||||
* @param Tile $tile
|
* @param Tile $tile
|
||||||
*/
|
*/
|
||||||
public function addTile(Tile $tile){
|
public function addTile(Tile $tile){
|
||||||
if($tile->closed){
|
if($tile->isClosed()){
|
||||||
throw new \InvalidArgumentException("Attempted to add a garbage closed Tile to a chunk");
|
throw new \InvalidArgumentException("Attempted to add a garbage closed Tile to a chunk");
|
||||||
}
|
}
|
||||||
$this->tiles[$tile->getId()] = $tile;
|
$this->tiles[$tile->getId()] = $tile;
|
||||||
|
@ -514,8 +514,9 @@ class LevelDB extends BaseLevelProvider{
|
|||||||
private function writeTags(array $targets, string $index){
|
private function writeTags(array $targets, string $index){
|
||||||
$nbt = new NBT(NBT::LITTLE_ENDIAN);
|
$nbt = new NBT(NBT::LITTLE_ENDIAN);
|
||||||
$out = [];
|
$out = [];
|
||||||
|
/** @var Entity|Tile $target */
|
||||||
foreach($targets as $target){
|
foreach($targets as $target){
|
||||||
if(!$target->closed){
|
if(!$target->isClosed()){
|
||||||
$target->saveNBT();
|
$target->saveNBT();
|
||||||
$out[] = $target->namedtag;
|
$out[] = $target->namedtag;
|
||||||
}
|
}
|
||||||
|
@ -180,6 +180,10 @@ abstract class Tile extends Position{
|
|||||||
$this->level->updateTiles[$this->id] = $this;
|
$this->level->updateTiles[$this->id] = $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function isClosed() : bool{
|
||||||
|
return $this->closed;
|
||||||
|
}
|
||||||
|
|
||||||
public function __destruct(){
|
public function __destruct(){
|
||||||
$this->close();
|
$this->close();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user