mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-16 16:34:05 +00:00
Addresses issues noted by @SOF3
This commit is contained in:
parent
6e0cebbe38
commit
eed8c37eab
@ -237,7 +237,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
//TODO: Abilities
|
//TODO: Abilities
|
||||||
protected $autoJump = true;
|
protected $autoJump = true;
|
||||||
protected $allowFlight = false;
|
protected $allowFlight = false;
|
||||||
protected $isFlying = false;
|
protected $flying = false;
|
||||||
|
|
||||||
private $needACK = [];
|
private $needACK = [];
|
||||||
|
|
||||||
@ -319,12 +319,12 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function setFlying(bool $value){
|
public function setFlying(bool $value){
|
||||||
$this->isFlying = $value;
|
$this->flying = $value;
|
||||||
$this->sendSettings();
|
$this->sendSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getIsFlying() : bool{
|
public function isFlying() : bool{
|
||||||
return $this->isFlying;
|
return $this->flying;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setAutoJump($value){
|
public function setAutoJump($value){
|
||||||
@ -507,14 +507,16 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
public function sendCommandData(){
|
public function sendCommandData(){
|
||||||
$pk = new AvailableCommandsPacket();
|
$pk = new AvailableCommandsPacket();
|
||||||
$data = new \stdClass();
|
$data = new \stdClass();
|
||||||
|
$count = 0;
|
||||||
foreach($this->server->getCommandMap()->getCommands() as $command){
|
foreach($this->server->getCommandMap()->getCommands() as $command){
|
||||||
if(!$command->testPermissionSilent($this)){
|
if(!$command->testPermissionSilent($this)){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
++$count;
|
||||||
$data->{$command->getName()}->versions[0] = $command->generateCustomCommandData($this);
|
$data->{$command->getName()}->versions[0] = $command->generateCustomCommandData($this);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($data) > 0){
|
if($count > 0){
|
||||||
//TODO: structure checking
|
//TODO: structure checking
|
||||||
$pk->commands = json_encode($data);
|
$pk->commands = json_encode($data);
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
@ -1120,7 +1122,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
|
|
||||||
$this->allowFlight = $this->isCreative();
|
$this->allowFlight = $this->isCreative();
|
||||||
if($this->isSpectator()){
|
if($this->isSpectator()){
|
||||||
$this->isFlying = true;
|
$this->flying = true;
|
||||||
$this->despawnFromAll();
|
$this->despawnFromAll();
|
||||||
|
|
||||||
// Client automatically turns off flight controls when on the ground.
|
// Client automatically turns off flight controls when on the ground.
|
||||||
@ -1129,7 +1131,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$this->teleport($this->temporalVector->setComponents($this->x, $this->y + 0.1, $this->z));
|
$this->teleport($this->temporalVector->setComponents($this->x, $this->y + 0.1, $this->z));
|
||||||
}else{
|
}else{
|
||||||
if($this->isSurvival()){
|
if($this->isSurvival()){
|
||||||
$this->isFlying = false;
|
$this->flying = false;
|
||||||
}
|
}
|
||||||
$this->spawnToAll();
|
$this->spawnToAll();
|
||||||
}
|
}
|
||||||
@ -1166,7 +1168,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
$pk->autoJump = $this->autoJump;
|
$pk->autoJump = $this->autoJump;
|
||||||
$pk->allowFlight = $this->allowFlight;
|
$pk->allowFlight = $this->allowFlight;
|
||||||
$pk->noClip = $this->isSpectator();
|
$pk->noClip = $this->isSpectator();
|
||||||
$pk->isFlying = $this->isFlying;
|
$pk->isFlying = $this->flying;
|
||||||
$pk->userPermission = 2;
|
$pk->userPermission = 2;
|
||||||
$this->dataPacket($pk);
|
$this->dataPacket($pk);
|
||||||
}
|
}
|
||||||
@ -1883,7 +1885,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
|||||||
if($ev->isCancelled()){
|
if($ev->isCancelled()){
|
||||||
$this->sendSettings();
|
$this->sendSettings();
|
||||||
}else{
|
}else{
|
||||||
$this->isFlying = $ev->isFlying();
|
$this->flying = $ev->isFlying();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user