Kill player below -16 as now the bottom of the world can be rendered, send player count

This commit is contained in:
Shoghi Cervantes 2015-05-15 16:51:20 +02:00
parent 76e6ccebd5
commit 7a34417e67
4 changed files with 16 additions and 2 deletions

View File

@ -2424,6 +2424,8 @@ class Server{
} }
} }
} }
$this->getNetwork()->updateName();
} }
if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){ if($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){

View File

@ -744,7 +744,7 @@ abstract class Entity extends Location implements Metadatable{
$this->checkBlockCollision(); $this->checkBlockCollision();
if($this->y < 0 and $this->isAlive()){ if($this->y <= -16 and $this->isAlive()){
$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10); $ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10);
$this->attack($ev->getFinalDamage(), $ev); $this->attack($ev->getFinalDamage(), $ev);
$hasUpdate = true; $hasUpdate = true;

View File

@ -195,6 +195,12 @@ class Network{
return $this->name; return $this->name;
} }
public function updateName(){
foreach($this->interfaces as $interface){
$interface->setName($this->name);
}
}
/** /**
* @param int $id 0-255 * @param int $id 0-255
* @param DataPacket $class * @param DataPacket $class

View File

@ -172,7 +172,13 @@ class RakLibInterface implements ServerInstance, AdvancedSourceInterface{
} }
public function setName($name){ 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){ public function setPortCheck($name){