mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-07 18:32:55 +00:00
Moved SetTitlePacket usage to NetworkSession (#3186)
This commit is contained in:
@ -85,7 +85,6 @@ use pocketmine\network\mcpe\protocol\ActorEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\AnimatePacket;
|
||||
use pocketmine\network\mcpe\protocol\LevelEventPacket;
|
||||
use pocketmine\network\mcpe\protocol\MovePlayerPacket;
|
||||
use pocketmine\network\mcpe\protocol\SetTitlePacket;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataFlags;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\EntityMetadataProperties;
|
||||
use pocketmine\network\mcpe\protocol\types\entity\PlayerMetadataFlags;
|
||||
@ -1900,7 +1899,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
if($subtitle !== ""){
|
||||
$this->sendSubTitle($subtitle);
|
||||
}
|
||||
$this->networkSession->sendDataPacket(SetTitlePacket::title($title));
|
||||
$this->networkSession->onTitle($title);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1909,7 +1908,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
* @param string $subtitle
|
||||
*/
|
||||
public function sendSubTitle(string $subtitle) : void{
|
||||
$this->networkSession->sendDataPacket(SetTitlePacket::subtitle($subtitle));
|
||||
$this->networkSession->onSubTitle($subtitle);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1918,21 +1917,21 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
* @param string $message
|
||||
*/
|
||||
public function sendActionBarMessage(string $message) : void{
|
||||
$this->networkSession->sendDataPacket(SetTitlePacket::actionBarMessage($message));
|
||||
$this->networkSession->onActionBar($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes the title from the client's screen.
|
||||
*/
|
||||
public function removeTitles(){
|
||||
$this->networkSession->sendDataPacket(SetTitlePacket::clearTitle());
|
||||
$this->networkSession->onClearTitle();
|
||||
}
|
||||
|
||||
/**
|
||||
* Resets the title duration settings to defaults and removes any existing titles.
|
||||
*/
|
||||
public function resetTitles(){
|
||||
$this->networkSession->sendDataPacket(SetTitlePacket::resetTitleOptions());
|
||||
$this->networkSession->onResetTitleOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1944,7 +1943,7 @@ class Player extends Human implements CommandSender, ChunkLoader, ChunkListener,
|
||||
*/
|
||||
public function setTitleDuration(int $fadeIn, int $stay, int $fadeOut){
|
||||
if($fadeIn >= 0 and $stay >= 0 and $fadeOut >= 0){
|
||||
$this->networkSession->sendDataPacket(SetTitlePacket::setAnimationTimes($fadeIn, $stay, $fadeOut));
|
||||
$this->networkSession->onTitleDuration($fadeIn, $stay, $fadeOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user