mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-11 00:09:39 +00:00
Rename addTitle/addSubTitle/addActionBarMessage prefixes to "send", deprecated old variants
closes #2896 these deprecated methods will be removed in 4.0.
This commit is contained in:
parent
d850a84d0d
commit
932c489de1
@ -3259,7 +3259,8 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a title text to the user's screen, with an optional subtitle.
|
||||
* @deprecated
|
||||
* @see Player::sendTitle()
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $subtitle
|
||||
@ -3268,28 +3269,61 @@ class Player extends Human implements CommandSender, ChunkLoader, IPlayer{
|
||||
* @param int $fadeOut Duration in ticks for fade-out.
|
||||
*/
|
||||
public function addTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1){
|
||||
$this->sendTitle($title, $subtitle, $fadeIn, $stay, $fadeOut);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a title text to the user's screen, with an optional subtitle.
|
||||
*
|
||||
* @param string $title
|
||||
* @param string $subtitle
|
||||
* @param int $fadeIn Duration in ticks for fade-in. If -1 is given, client-sided defaults will be used.
|
||||
* @param int $stay Duration in ticks to stay on screen for
|
||||
* @param int $fadeOut Duration in ticks for fade-out.
|
||||
*/
|
||||
public function sendTitle(string $title, string $subtitle = "", int $fadeIn = -1, int $stay = -1, int $fadeOut = -1) : void{
|
||||
$this->setTitleDuration($fadeIn, $stay, $fadeOut);
|
||||
if($subtitle !== ""){
|
||||
$this->addSubTitle($subtitle);
|
||||
$this->sendSubTitle($subtitle);
|
||||
}
|
||||
$this->sendTitleText($title, SetTitlePacket::TYPE_SET_TITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Player::sendSubTitle()
|
||||
*
|
||||
* @param string $subtitle
|
||||
*/
|
||||
public function addSubTitle(string $subtitle){
|
||||
$this->sendSubTitle($subtitle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the subtitle message, without sending a title.
|
||||
*
|
||||
* @param string $subtitle
|
||||
*/
|
||||
public function addSubTitle(string $subtitle){
|
||||
public function sendSubTitle(string $subtitle) : void{
|
||||
$this->sendTitleText($subtitle, SetTitlePacket::TYPE_SET_SUBTITLE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
* @see Player::sendActionBarMessage()
|
||||
*
|
||||
* @param string $message
|
||||
*/
|
||||
public function addActionBarMessage(string $message){
|
||||
$this->sendActionBarMessage($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds small text to the user's screen.
|
||||
*
|
||||
* @param string $message
|
||||
*/
|
||||
public function addActionBarMessage(string $message){
|
||||
public function sendActionBarMessage(string $message) : void{
|
||||
$this->sendTitleText($message, SetTitlePacket::TYPE_SET_ACTIONBAR_MESSAGE);
|
||||
}
|
||||
|
||||
|
@ -1872,7 +1872,7 @@ class Server{
|
||||
|
||||
/** @var Player[] $recipients */
|
||||
foreach($recipients as $recipient){
|
||||
$recipient->addTitle($title, $subtitle, $fadeIn, $stay, $fadeOut);
|
||||
$recipient->sendTitle($title, $subtitle, $fadeIn, $stay, $fadeOut);
|
||||
}
|
||||
|
||||
return count($recipients);
|
||||
|
@ -68,21 +68,21 @@ class TitleCommand extends VanillaCommand{
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
$player->addTitle(implode(" ", array_slice($args, 2)));
|
||||
$player->sendTitle(implode(" ", array_slice($args, 2)));
|
||||
break;
|
||||
case "subtitle":
|
||||
if(count($args) < 3){
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
$player->addSubTitle(implode(" ", array_slice($args, 2)));
|
||||
$player->sendSubTitle(implode(" ", array_slice($args, 2)));
|
||||
break;
|
||||
case "actionbar":
|
||||
if(count($args) < 3){
|
||||
throw new InvalidCommandSyntaxException();
|
||||
}
|
||||
|
||||
$player->addActionBarMessage(implode(" ", array_slice($args, 2)));
|
||||
$player->sendActionBarMessage(implode(" ", array_slice($args, 2)));
|
||||
break;
|
||||
case "times":
|
||||
if(count($args) < 5){
|
||||
|
Loading…
x
Reference in New Issue
Block a user