mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-13 05:15:13 +00:00
Level: fixed setChunk() bug introduced by eebd90ec4245abbcdddfc11fe3f4dc36a008f19e
Anyone who is using getChunkPlayers() should probably check that their code is actually doing what they think it's doing.
This commit is contained in:
parent
ddbb5363ef
commit
5fe1d2e396
@ -616,7 +616,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the players being used in a specific chunk
|
* @deprecated WARNING: This function has a misleading name. Contrary to what the name might imply, this function
|
||||||
|
* DOES NOT return players who are IN a chunk, rather, it returns players who can SEE the chunk.
|
||||||
|
*
|
||||||
|
* Returns a list of players who have the target chunk within their view distance.
|
||||||
*
|
*
|
||||||
* @param int $chunkX
|
* @param int $chunkX
|
||||||
* @param int $chunkZ
|
* @param int $chunkZ
|
||||||
@ -2490,8 +2493,10 @@ class Level implements ChunkManager, Metadatable{
|
|||||||
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
$oldChunk = $this->getChunk($chunkX, $chunkZ, false);
|
||||||
if($oldChunk !== null and $oldChunk !== $chunk){
|
if($oldChunk !== null and $oldChunk !== $chunk){
|
||||||
if($deleteEntitiesAndTiles){
|
if($deleteEntitiesAndTiles){
|
||||||
$players = $this->getChunkPlayers($chunkX, $chunkZ);
|
foreach($oldChunk->getEntities() as $player){
|
||||||
foreach($players as $player){
|
if(!($player instanceof Player)){
|
||||||
|
continue;
|
||||||
|
}
|
||||||
$chunk->addEntity($player);
|
$chunk->addEntity($player);
|
||||||
$oldChunk->removeEntity($player);
|
$oldChunk->removeEntity($player);
|
||||||
$player->chunk = $chunk;
|
$player->chunk = $chunk;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user