mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Added title command and API for resetting title duration
This commit is contained in:
committed by
Dylan K. Taylor
parent
84ec944b6b
commit
653b6b55a9
@ -3439,11 +3439,20 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
public function addTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1){
|
||||
$this->setTitleDuration($fadeIn, $stay, $fadeOut);
|
||||
if($subtitle !== ""){
|
||||
$this->sendTitleText($subtitle, SetTitlePacket::TYPE_SET_SUBTITLE);
|
||||
$this->addSubTitle($subtitle);
|
||||
}
|
||||
$this->sendTitleText($title, SetTitlePacket::TYPE_SET_TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the subtitle message, without sending a title.
|
||||
*
|
||||
* @param string $subtitle
|
||||
*/
|
||||
public function addSubTitle(string $subtitle){
|
||||
$this->sendTitleText($subtitle, SetTitlePacket::TYPE_SET_SUBTITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds small text to the user's screen.
|
||||
*
|
||||
@ -3462,6 +3471,15 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the title duration settings.
|
||||
*/
|
||||
public function resetTitles(){
|
||||
$pk = new SetTitlePacket();
|
||||
$pk->type = SetTitlePacket::TYPE_RESET_TITLE;
|
||||
$this->dataPacket($pk);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title duration.
|
||||
*
|
||||
|
Reference in New Issue
Block a user