Added WorldBuilder flag to AdventureSettingsPacket

This commit is contained in:
Dylan K. Taylor
2017-02-23 12:20:36 +00:00
parent 4ae18526d1
commit 99995579d7

View File

@ -33,15 +33,16 @@ class AdventureSettingsPacket extends DataPacket{
const PERMISSION_AUTOMATION = 3; const PERMISSION_AUTOMATION = 3;
const PERMISSION_ADMIN = 4; const PERMISSION_ADMIN = 4;
public $worldImmutable; public $worldImmutable = false;
public $noPvp; public $noPvp = false;
public $noPvm; public $noPvm = false;
public $noMvp; public $noMvp = false;
public $autoJump; public $autoJump = true;
public $allowFlight; public $allowFlight = false;
public $noClip; public $noClip = false;
public $isFlying; public $worldBuilder = false;
public $isFlying = false;
/* /*
bit mask | flag name bit mask | flag name
@ -53,7 +54,7 @@ class AdventureSettingsPacket extends DataPacket{
0x00000020 auto_jump 0x00000020 auto_jump
0x00000040 allow_fly 0x00000040 allow_fly
0x00000080 noclip 0x00000080 noclip
0x00000100 ? 0x00000100 world_builder (seems to allow building even if the world_immutable flag is set (???))
0x00000200 is_flying 0x00000200 is_flying
*/ */
@ -72,7 +73,7 @@ class AdventureSettingsPacket extends DataPacket{
$this->autoJump = (bool) ($this->flags & (1 << 5)); $this->autoJump = (bool) ($this->flags & (1 << 5));
$this->allowFlight = (bool) ($this->flags & (1 << 6)); $this->allowFlight = (bool) ($this->flags & (1 << 6));
$this->noClip = (bool) ($this->flags & (1 << 7)); $this->noClip = (bool) ($this->flags & (1 << 7));
$this->worldBuilder = (bool) ($this->flags & (1 << 8));
$this->isFlying = (bool) ($this->flags & (1 << 9)); $this->isFlying = (bool) ($this->flags & (1 << 9));
} }
@ -80,15 +81,15 @@ class AdventureSettingsPacket extends DataPacket{
$this->reset(); $this->reset();
$this->flags |= ((int) $this->worldImmutable); $this->flags |= ((int) $this->worldImmutable);
$this->flags |= ((int) $this->noPvp) << 1; $this->flags |= ((int) $this->noPvp) << 1;
$this->flags |= ((int) $this->noPvm) << 2; $this->flags |= ((int) $this->noPvm) << 2;
$this->flags |= ((int) $this->noMvp) << 3; $this->flags |= ((int) $this->noMvp) << 3;
$this->flags |= ((int) $this->autoJump) << 5; $this->flags |= ((int) $this->autoJump) << 5;
$this->flags |= ((int) $this->allowFlight) << 6; $this->flags |= ((int) $this->allowFlight) << 6;
$this->flags |= ((int) $this->noClip) << 7; $this->flags |= ((int) $this->noClip) << 7;
$this->flags |= ((int) $this->worldBuilder) << 8;
$this->flags |= ((int) $this->isFlying) << 9; $this->flags |= ((int) $this->isFlying) << 9;
$this->putUnsignedVarInt($this->flags); $this->putUnsignedVarInt($this->flags);
$this->putUnsignedVarInt($this->userPermission); $this->putUnsignedVarInt($this->userPermission);