mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Added some wrapper methods to make data flags less of a pain in the ass to work with
This commit is contained in:
@ -283,7 +283,7 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
|
||||
protected function initEntity(){
|
||||
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);
|
||||
$this->setPlayerFlag(self::DATA_PLAYER_FLAG_SLEEP, false);
|
||||
$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0], false);
|
||||
|
||||
$this->inventory = new PlayerInventory($this);
|
||||
@ -542,4 +542,24 @@ class Human extends Creature implements ProjectileSource, InventoryHolder{
|
||||
parent::close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around {@link Entity#getDataFlag} for player-specific data flag reading.
|
||||
*
|
||||
* @param int $flagId
|
||||
* @return bool
|
||||
*/
|
||||
public function getPlayerFlag(int $flagId){
|
||||
return $this->getDataFlag(self::DATA_PLAYER_FLAGS, $flagId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper around {@link Entity#setDataFlag} for player-specific data flag setting.
|
||||
*
|
||||
* @param int $flagId
|
||||
* @param bool $value
|
||||
*/
|
||||
public function setPlayerFlag(int $flagId, bool $value = true){
|
||||
$this->setDataFlag(self::DATA_PLAYER_FLAGS, $flagId, $value, self::DATA_TYPE_BYTE);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user