Merge branch 'master' into mcpe-1.2

This commit is contained in:
Dylan K. Taylor 2017-08-23 13:20:35 +01:00
commit 95752ef542
12 changed files with 28 additions and 20 deletions

View File

@ -1786,7 +1786,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
return;
}
foreach($this->server->getOnlinePlayers() as $p){
foreach($this->server->getLoggedInPlayers() as $p){
if($p !== $this and $p->iusername === $this->iusername){
if($p->kick("logged in from another location") === false){
$this->close($this->getLeaveMessage(), "Logged in from another location");
@ -1843,6 +1843,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->sendPlayStatus(PlayStatusPacket::LOGIN_SUCCESS);
$this->loggedIn = true;
$this->server->onPlayerLogin($this);
$pk = new ResourcePacksInfoPacket();
$manager = $this->server->getResourceManager();
@ -1926,8 +1927,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
}
$this->server->addOnlinePlayer($this);
$this->server->onPlayerLogin($this);
$this->server->onPlayerCompleteLoginSequence($this);
}
public function handleLogin(LoginPacket $packet) : bool{
@ -3492,6 +3492,7 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
$this->loadQueue = [];
if($this->loggedIn){
$this->server->onPlayerLogout($this);
foreach($this->server->getOnlinePlayers() as $player){
if(!$player->canSee($this)){
$player->showPlayer($this);

View File

@ -254,6 +254,9 @@ class Server{
/** @var Player[] */
private $players = [];
/** @var Player[] */
private $loggedInPlayers = [];
/** @var Player[] */
private $playerList = [];
@ -689,6 +692,13 @@ class Server{
return $this->commandMap;
}
/**
* @return Player[]
*/
public function getLoggedInPlayers() : array{
return $this->loggedInPlayers;
}
/**
* @return Player[]
*/
@ -2234,10 +2244,18 @@ class Server{
$this->uniquePlayers[$player->getRawUniqueId()] = $player->getRawUniqueId();
}
$this->loggedInPlayers[$player->getRawUniqueId()] = $player;
}
public function onPlayerCompleteLoginSequence(Player $player){
$this->sendFullPlayerListData($player);
$player->dataPacket($this->craftingManager->getCraftingDataPacket());
}
public function onPlayerLogout(Player $player){
unset($this->loggedInPlayers[$player->getRawUniqueId()]);
}
public function addPlayer($identifier, Player $player){
$this->players[$identifier] = $player;
$this->identifiers[spl_object_hash($player)] = $identifier;

View File

@ -32,7 +32,6 @@ class Arrow extends Projectile{
const NETWORK_ID = 80;
public $width = 0.5;
public $length = 0.5;
public $height = 0.5;
protected $gravity = 0.05;
@ -95,4 +94,4 @@ class Arrow extends Projectile{
parent::spawnTo($player);
}
}
}

View File

@ -300,8 +300,6 @@ abstract class Entity extends Location implements Metadatable{
public $height;
/** @var float */
public $width;
/** @var float */
public $length;
/** @var float */
protected $baseOffset = 0.0;
@ -1352,9 +1350,9 @@ abstract class Entity extends Location implements Metadatable{
final public function hasMovementUpdate() : bool{
return (
$this->forceMovementUpdate or
abs($this->motionX) > self::MOTION_THRESHOLD or
abs($this->motionY) > self::MOTION_THRESHOLD or
abs($this->motionZ) > self::MOTION_THRESHOLD or
$this->motionX != 0 or
$this->motionY != 0 or
$this->motionZ != 0 or
!$this->onGround
);
}

View File

@ -38,7 +38,6 @@ class FallingSand extends Entity{
const NETWORK_ID = 66;
public $width = 0.98;
public $length = 0.98;
public $height = 0.98;
protected $baseOffset = 0.49;

View File

@ -59,7 +59,6 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
protected $rawUUID;
public $width = 0.6;
public $length = 0.6;
public $height = 1.8;
public $eyeHeight = 1.62;

View File

@ -46,7 +46,6 @@ class Item extends Entity{
protected $item;
public $width = 0.25;
public $length = 0.25;
public $height = 0.25;
protected $baseOffset = 0.125;

View File

@ -35,7 +35,6 @@ class PrimedTNT extends Entity implements Explosive{
const NETWORK_ID = 65;
public $width = 0.98;
public $length = 0.98;
public $height = 0.98;
protected $baseOffset = 0.49;
@ -125,4 +124,4 @@ class PrimedTNT extends Entity implements Explosive{
parent::spawnTo($player);
}
}
}

View File

@ -32,7 +32,6 @@ class Snowball extends Projectile{
const NETWORK_ID = 81;
public $width = 0.25;
public $length = 0.25;
public $height = 0.25;
protected $gravity = 0.03;
@ -68,4 +67,4 @@ class Snowball extends Projectile{
parent::spawnTo($player);
}
}
}

View File

@ -36,7 +36,6 @@ class Squid extends WaterAnimal{
const NETWORK_ID = 17;
public $width = 0.95;
public $length = 0.95;
public $height = 0.95;
/** @var Vector3 */

View File

@ -38,7 +38,6 @@ class Villager extends Creature implements NPC, Ageable{
const NETWORK_ID = 15;
public $width = 0.6;
public $length = 0.6;
public $height = 1.8;
public function getName() : string{

View File

@ -33,7 +33,6 @@ class Zombie extends Monster{
const NETWORK_ID = 32;
public $width = 0.6;
public $length = 0.6;
public $height = 1.8;
public function getName() : string{