Add some permission constants to AdventureSettings

This commit is contained in:
Dylan K. Taylor 2016-10-26 12:55:41 +01:00
parent d9e6676176
commit 813bb98850
2 changed files with 8 additions and 2 deletions

View File

@ -1170,7 +1170,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$pk->allowFlight = $this->allowFlight; $pk->allowFlight = $this->allowFlight;
$pk->noClip = $this->isSpectator(); $pk->noClip = $this->isSpectator();
$pk->isFlying = $this->flying; $pk->isFlying = $this->flying;
$pk->userPermission = 2; $pk->userPermission = ($this->isOp() ? AdventureSettingsPacket::PERMISSION_OPERATOR : AdventureSettingsPacket::PERMISSION_NORMAL);
$this->dataPacket($pk); $this->dataPacket($pk);
} }

View File

@ -27,6 +27,12 @@ namespace pocketmine\network\protocol;
class AdventureSettingsPacket extends DataPacket{ class AdventureSettingsPacket extends DataPacket{
const NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET; const NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET;
const PERMISSION_NORMAL = 0;
const PERMISSION_OPERATOR = 1;
const PERMISSION_HOST = 2;
const PERMISSION_AUTOMATION = 3;
const PERMISSION_ADMIN = 4;
public $worldImmutable; public $worldImmutable;
public $noPvp; public $noPvp;
public $noPvm; public $noPvm;
@ -85,7 +91,7 @@ class AdventureSettingsPacket extends DataPacket{
$this->flags |= ((int) $this->isFlying) << 9; $this->flags |= ((int) $this->isFlying) << 9;
$this->putUnsignedVarInt($this->flags); $this->putUnsignedVarInt($this->flags);
$this->putUnsignedVarInt($this->userPermission); //TODO: verify this $this->putUnsignedVarInt($this->userPermission);
} }
} }