mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Fixed crash on /stop
This commit is contained in:
parent
cb879977d2
commit
304524f6d8
@ -1643,7 +1643,7 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
];
|
||||
|
||||
$damage = [
|
||||
EntityDamageByEntityEvent::MODIFIER_BASE => isset($damageTable[$item->getID()]) ? $damageTable[$item->getID()] : 1,
|
||||
EntityDamageEvent::MODIFIER_BASE => isset($damageTable[$item->getID()]) ? $damageTable[$item->getID()] : 1,
|
||||
];
|
||||
|
||||
if($this->distance($target) > 8){
|
||||
|
@ -131,26 +131,27 @@ class Anvil extends BaseLevelProvider{
|
||||
|
||||
public function unloadChunk($x, $z, $safe = true){
|
||||
$chunk = $this->getChunk($x, $z, false);
|
||||
if($safe === true and $this->isChunkLoaded($x, $z)){
|
||||
foreach($chunk->getEntities() as $entity){
|
||||
if($entity instanceof Player){
|
||||
return false;
|
||||
if($chunk instanceof Chunk){
|
||||
if($safe === true and $this->isChunkLoaded($x, $z)){
|
||||
foreach($chunk->getEntities() as $entity){
|
||||
if($entity instanceof Player){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach($chunk->getEntities() as $entity){
|
||||
$entity->close();
|
||||
}
|
||||
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
$tile->close();
|
||||
}
|
||||
|
||||
$this->chunks[$index = Level::chunkHash($x, $z)] = null;
|
||||
|
||||
unset($this->chunks[$index]);
|
||||
}
|
||||
|
||||
foreach($chunk->getEntities() as $entity){
|
||||
$entity->close();
|
||||
}
|
||||
|
||||
foreach($chunk->getTiles() as $tile){
|
||||
$tile->close();
|
||||
}
|
||||
|
||||
$this->chunks[$index = Level::chunkHash($x, $z)] = null;
|
||||
|
||||
unset($this->chunks[$index]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user