mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-13 01:09:44 +00:00
Added server-side join message (removed from client-side MCPE)
This commit is contained in:
parent
cb1c4da4ea
commit
c4673addf7
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user