diff --git a/src/pocketmine/Player.php b/src/pocketmine/Player.php index 848aa4065..c4cf1bf72 100644 --- a/src/pocketmine/Player.php +++ b/src/pocketmine/Player.php @@ -51,7 +51,6 @@ use pocketmine\inventory\InventoryHolder; use pocketmine\inventory\SimpleTransactionGroup; use pocketmine\inventory\StonecutterShapelessRecipe; use pocketmine\item\Item; -use pocketmine\level\format\pmf\LevelFormat; use pocketmine\level\Level; use pocketmine\level\Position; use pocketmine\math\Vector3; @@ -1191,7 +1190,8 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{ $this->server->getLogger()->info(TextFormat::AQUA . $this->username . TextFormat::WHITE . "[/" . $this->ip . ":" . $this->port . "] logged in with entity id " . $this->id . " at (" . $this->getLevel()->getName() . ", " . round($this->x, 4) . ", " . round($this->y, 4) . ", " . round($this->z, 4) . ")"); - $this->server->getPluginManager()->callEvent(new PlayerJoinEvent($this, $this->username . " joined the game")); + $this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, $this->username . " joined the game")); + $this->server->broadcastMessage($ev->getJoinMessage()); $this->orderChunks(); diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index a502e109e..f7c108d8e 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -594,7 +594,7 @@ abstract class Entity extends Position implements Metadatable{ foreach($this->getLevel()->getChunkEntities($X, $Z) as $entity){ $entity->despawnFrom($this); } - + $pk = new UnloadChunkPacket(); $pk->chunkX = $X; $pk->chunkZ = $Z; diff --git a/src/pocketmine/level/Level.php b/src/pocketmine/level/Level.php index 61df47511..59042f066 100644 --- a/src/pocketmine/level/Level.php +++ b/src/pocketmine/level/Level.php @@ -1294,6 +1294,11 @@ class Level implements ChunkManager, Metadatable{ unset($this->entities[$entity->getID()]); } + /** + * @param Entity $entity + * + * @throws \RuntimeException + */ public function addEntity(Entity $entity){ if($entity->getLevel() !== $this){ throw new \RuntimeException("Invalid Entity level"); @@ -1304,6 +1309,11 @@ class Level implements ChunkManager, Metadatable{ $this->entities[$entity->getID()] = $entity; } + /** + * @param Tile $tile + * + * @throws \RuntimeException + */ public function addTile(Tile $tile){ if($tile->getLevel() !== $this){ throw new \RuntimeException("Invalid Tile level"); @@ -1311,6 +1321,11 @@ class Level implements ChunkManager, Metadatable{ $this->tiles[$tile->getID()] = $tile; } + /** + * @param Tile $tile + * + * @throws \RuntimeException + */ public function removeTile(Tile $tile){ if($tile->getLevel() !== $this){ throw new \RuntimeException("Invalid Tile level"); @@ -1321,10 +1336,23 @@ class Level implements ChunkManager, Metadatable{ unset($this->tiles[$tile->getID()]); } + /** + * @param int $x + * @param int $z + * + * @return bool + */ public function isChunkInUse($x, $z){ return isset($this->usedChunks[static::chunkHash($x, $z)]); } + /** + * @param int $x + * @param int $z + * @param bool $generate + * + * @return bool + */ public function loadChunk($x, $z, $generate = true){ if($generate === true){ return $this->getChunkAt($x, $z, true) instanceof Chunk;