mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +00:00
Merge branch 'release/3.1'
This commit is contained in:
commit
4a11ded185
@ -769,6 +769,9 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
if(count($this->changedBlocks) > 0){
|
if(count($this->changedBlocks) > 0){
|
||||||
if(count($this->players) > 0){
|
if(count($this->players) > 0){
|
||||||
foreach($this->changedBlocks as $index => $blocks){
|
foreach($this->changedBlocks as $index => $blocks){
|
||||||
|
if(empty($blocks)){ //blocks can be set normally and then later re-set with direct send
|
||||||
|
continue;
|
||||||
|
}
|
||||||
unset($this->chunkCache[$index]);
|
unset($this->chunkCache[$index]);
|
||||||
Level::getXZ($index, $chunkX, $chunkZ);
|
Level::getXZ($index, $chunkX, $chunkZ);
|
||||||
if(count($blocks) > 512){
|
if(count($blocks) > 512){
|
||||||
@ -776,7 +779,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
foreach($this->getChunkPlayers($chunkX, $chunkZ) as $p){
|
foreach($this->getChunkPlayers($chunkX, $chunkZ) as $p){
|
||||||
$p->onChunkChanged($chunk);
|
$p->onChunkChanged($chunk);
|
||||||
}
|
}
|
||||||
}elseif(!empty($blocks)){
|
}else{
|
||||||
$this->sendBlocks($this->getChunkPlayers($chunkX, $chunkZ), $blocks, UpdateBlockPacket::FLAG_ALL);
|
$this->sendBlocks($this->getChunkPlayers($chunkX, $chunkZ), $blocks, UpdateBlockPacket::FLAG_ALL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2346,21 +2349,20 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
$chunkHash = Level::chunkHash($chunkX, $chunkZ);
|
$chunkHash = Level::chunkHash($chunkX, $chunkZ);
|
||||||
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
||||||
if($unload and $oldChunk !== null){
|
if($oldChunk !== null){
|
||||||
$this->unloadChunk($chunkX, $chunkZ, false, false);
|
if($unload){
|
||||||
}else{
|
$this->unloadChunk($chunkX, $chunkZ, false, false);
|
||||||
$oldEntities = $oldChunk !== null ? $oldChunk->getEntities() : [];
|
}else{
|
||||||
$oldTiles = $oldChunk !== null ? $oldChunk->getTiles() : [];
|
foreach($oldChunk->getEntities() as $entity){
|
||||||
|
$chunk->addEntity($entity);
|
||||||
|
$oldChunk->removeEntity($entity);
|
||||||
|
$entity->chunk = $chunk;
|
||||||
|
}
|
||||||
|
|
||||||
foreach($oldEntities as $entity){
|
foreach($oldChunk->getTiles() as $tile){
|
||||||
$chunk->addEntity($entity);
|
$chunk->addTile($tile);
|
||||||
$oldChunk->removeEntity($entity);
|
$oldChunk->removeTile($tile);
|
||||||
$entity->chunk = $chunk;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
foreach($oldTiles as $tile){
|
|
||||||
$chunk->addTile($tile);
|
|
||||||
$oldChunk->removeTile($tile);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2368,6 +2370,7 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
|
|
||||||
unset($this->blockCache[$chunkHash]);
|
unset($this->blockCache[$chunkHash]);
|
||||||
unset($this->chunkCache[$chunkHash]);
|
unset($this->chunkCache[$chunkHash]);
|
||||||
|
unset($this->changedBlocks[$chunkHash]);
|
||||||
$chunk->setChanged();
|
$chunk->setChanged();
|
||||||
|
|
||||||
if(!$this->isChunkInUse($chunkX, $chunkZ)){
|
if(!$this->isChunkInUse($chunkX, $chunkZ)){
|
||||||
|
@ -80,7 +80,7 @@ class RCONInstance extends Thread{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function readPacket($client, ?int &$requestID, ?int &$packetType, ?string &$payload){
|
private function readPacket($client, ?int &$requestID, ?int &$packetType, ?string &$payload){
|
||||||
$d = socket_read($client, 4);
|
$d = @socket_read($client, 4);
|
||||||
if($this->stop){
|
if($this->stop){
|
||||||
return false;
|
return false;
|
||||||
}elseif($d === false){
|
}elseif($d === false){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user