From 7a34417e67368ea02751078074e027864f7c0109 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Fri, 15 May 2015 16:51:20 +0200 Subject: [PATCH] Kill player below -16 as now the bottom of the world can be rendered, send player count --- src/pocketmine/Server.php | 2 ++ src/pocketmine/entity/Entity.php | 2 +- src/pocketmine/network/Network.php | 6 ++++++ src/pocketmine/network/RakLibInterface.php | 8 +++++++- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/pocketmine/Server.php b/src/pocketmine/Server.php index 0285f935e..c97c88398 100644 --- a/src/pocketmine/Server.php +++ b/src/pocketmine/Server.php @@ -2424,6 +2424,8 @@ class Server{ } } } + + $this->getNetwork()->updateName(); } if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){ diff --git a/src/pocketmine/entity/Entity.php b/src/pocketmine/entity/Entity.php index 13457bcc3..e63b6feb3 100644 --- a/src/pocketmine/entity/Entity.php +++ b/src/pocketmine/entity/Entity.php @@ -744,7 +744,7 @@ abstract class Entity extends Location implements Metadatable{ $this->checkBlockCollision(); - if($this->y < 0 and $this->isAlive()){ + if($this->y <= -16 and $this->isAlive()){ $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10); $this->attack($ev->getFinalDamage(), $ev); $hasUpdate = true; diff --git a/src/pocketmine/network/Network.php b/src/pocketmine/network/Network.php index e3aa3d039..8e2b7ed36 100644 --- a/src/pocketmine/network/Network.php +++ b/src/pocketmine/network/Network.php @@ -195,6 +195,12 @@ class Network{ return $this->name; } + public function updateName(){ + foreach($this->interfaces as $interface){ + $interface->setName($this->name); + } + } + /** * @param int $id 0-255 * @param DataPacket $class diff --git a/src/pocketmine/network/RakLibInterface.php b/src/pocketmine/network/RakLibInterface.php index 000fb912d..4ffae87e6 100644 --- a/src/pocketmine/network/RakLibInterface.php +++ b/src/pocketmine/network/RakLibInterface.php @@ -172,7 +172,13 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{ } public function setName($name){ - $this->interface->sendOption("name", "MCPE;".addcslashes($name, ";").";".Info::CURRENT_PROTOCOL.";".\pocketmine\MINECRAFT_VERSION_NETWORK); + $this->interface->sendOption("name", + "MCPE;".addcslashes($name, ";") .";". + Info::CURRENT_PROTOCOL.";". + \pocketmine\MINECRAFT_VERSION_NETWORK.";". + count($this->server->getOnlinePlayers()).";". + $this->server->getMaxPlayers() + ); } public function setPortCheck($name){