mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 00:07:30 +00:00
Introduce Player::sendToastNotification() (#5102)
This commit is contained in:
parent
7d29ac8293
commit
e4fc523251
@ -88,6 +88,7 @@ use pocketmine\network\mcpe\protocol\SetTimePacket;
|
||||
use pocketmine\network\mcpe\protocol\SetTitlePacket;
|
||||
use pocketmine\network\mcpe\protocol\TakeItemActorPacket;
|
||||
use pocketmine\network\mcpe\protocol\TextPacket;
|
||||
use pocketmine\network\mcpe\protocol\ToastRequestPacket;
|
||||
use pocketmine\network\mcpe\protocol\TransferPacket;
|
||||
use pocketmine\network\mcpe\protocol\types\BlockPosition;
|
||||
use pocketmine\network\mcpe\protocol\types\command\CommandData;
|
||||
@ -1100,6 +1101,10 @@ class NetworkSession{
|
||||
$this->sendDataPacket(EmotePacket::create($from->getId(), $emoteId, EmotePacket::FLAG_SERVER));
|
||||
}
|
||||
|
||||
public function onToastNotification(string $title, string $body) : void{
|
||||
$this->sendDataPacket(ToastRequestPacket::create($title, $body));
|
||||
}
|
||||
|
||||
public function tick() : void{
|
||||
if($this->info === null){
|
||||
if(time() >= $this->connectTime + 10){
|
||||
|
@ -1986,6 +1986,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.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user