mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 16:51:42 +00:00
Fixed player flags (now can sleep!)
This commit is contained in:
parent
6c1dd81130
commit
0f261b7baa
@ -1016,7 +1016,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->sleeping = clone $pos;
|
||||
|
||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]);
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, true);
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, true, self::DATA_TYPE_BYTE);
|
||||
|
||||
$this->setSpawn($pos);
|
||||
|
||||
@ -1051,7 +1051,7 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
|
||||
$this->sleeping = null;
|
||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false);
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);
|
||||
|
||||
$this->level->sleepTicks = 0;
|
||||
|
||||
@ -1098,11 +1098,12 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
/**
|
||||
* Sets the gamemode, and if needed, kicks the Player.
|
||||
*
|
||||
* @param int $gm
|
||||
* @param int $gm
|
||||
* @param bool $client if the client made this change in their GUI
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function setGamemode($gm, $client = false){
|
||||
public function setGamemode(int $gm, bool $client = false){
|
||||
if($gm < 0 or $gm > 3 or $this->gamemode === $gm){
|
||||
return false;
|
||||
}
|
||||
|
@ -86,8 +86,8 @@ abstract class Entity extends Location implements Metadatable{
|
||||
const DATA_AIR = 7; //short
|
||||
/* 8 (int)
|
||||
* 9 (int)
|
||||
* 27 (byte) something to do with beds
|
||||
* 28 (int)
|
||||
* 27 (byte) player-specific flags
|
||||
* 28 (int) player "index"?
|
||||
* 29 (block coords) bed position */
|
||||
const DATA_LEAD_HOLDER_EID = 38; //long
|
||||
const DATA_SCALE = 39; //float
|
||||
|
@ -42,10 +42,10 @@ use pocketmine\utils\UUID;
|
||||
|
||||
class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
|
||||
const DATA_PLAYER_FLAG_SLEEP = 1; //TODO: CHECK
|
||||
const DATA_PLAYER_FLAG_SLEEP = 1;
|
||||
const DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK
|
||||
|
||||
const DATA_PLAYER_FLAGS = 16; //TODO: CHECK
|
||||
const DATA_PLAYER_FLAGS = 27;
|
||||
|
||||
const DATA_PLAYER_BED_POSITION = 29;
|
||||
|
||||
@ -254,7 +254,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
|
||||
protected function initEntity(){
|
||||
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false);
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);
|
||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0], false);
|
||||
|
||||
$this->inventory = new PlayerInventory($this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user