mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
Merge branch 'next-minor' into next-major
This commit is contained in:
@ -420,6 +420,15 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
return $this->lastPlayed - $this->firstPlayed > 1; // microtime(true) - microtime(true) may have less than one millisecond difference
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the player is allowed to toggle flight mode.
|
||||
*
|
||||
* If set to false, the player will be locked in its current flight mode (flying/not flying), and attempts by the
|
||||
* player to enter or exit flight mode will be prevented.
|
||||
*
|
||||
* Note: Setting this to false DOES NOT change whether the player is currently flying. Use
|
||||
* {@link Player::setFlying()} for that purpose.
|
||||
*/
|
||||
public function setAllowFlight(bool $value) : void{
|
||||
if($this->allowFlight !== $value){
|
||||
$this->allowFlight = $value;
|
||||
@ -427,10 +436,24 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether the player is allowed to toggle its flight state.
|
||||
*
|
||||
* If false, the player is locked in its current flight mode (flying/not flying), and attempts by the player to
|
||||
* enter or exit flight mode will be prevented.
|
||||
*/
|
||||
public function getAllowFlight() : bool{
|
||||
return $this->allowFlight;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets whether the player's movement may be obstructed by blocks with collision boxes.
|
||||
* If set to false, the player can move through any block unobstructed.
|
||||
*
|
||||
* Note: Enabling flight mode in conjunction with this is recommended. A non-flying player will simply fall through
|
||||
* the ground into the void.
|
||||
* @see Player::setFlying()
|
||||
*/
|
||||
public function setHasBlockCollision(bool $value) : void{
|
||||
if($this->blockCollision !== $value){
|
||||
$this->blockCollision = $value;
|
||||
@ -438,6 +461,10 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns whether blocks may obstruct the player's movement.
|
||||
* If false, the player can move through any block unobstructed.
|
||||
*/
|
||||
public function hasBlockCollision() : bool{
|
||||
return $this->blockCollision;
|
||||
}
|
||||
@ -1023,7 +1050,7 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
protected function internalSetGameMode(GameMode $gameMode) : void{
|
||||
$this->gamemode = $gameMode;
|
||||
|
||||
$this->allowFlight = $this->isCreative();
|
||||
$this->allowFlight = $this->gamemode->equals(GameMode::CREATIVE());
|
||||
$this->hungerManager->setEnabled($this->isSurvival());
|
||||
|
||||
if($this->isSpectator()){
|
||||
@ -1992,6 +2019,13 @@ class Player extends Human implements CommandSender, ChunkListener, IPlayer{
|
||||
$this->getNetworkSession()->onTip($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a toast message to the player, or queue to send it if a toast message is already shown.
|
||||
*/
|
||||
public function sendToastNotification(string $title, string $body) : void{
|
||||
$this->getNetworkSession()->onToastNotification($title, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends a Form to the player, or queue to send it if a form is already open.
|
||||
*
|
||||
|
Reference in New Issue
Block a user