Added whisper

This commit is contained in:
Kripth 2016-11-03 18:18:53 +01:00 committed by SOFe
parent da23568546
commit 208884422d
2 changed files with 10 additions and 0 deletions

View File

@ -2989,6 +2989,14 @@ class Player extends Human implements CommandSender, InventoryHolder, ChunkLoade
$pk->message = $message;
$this->dataPacket($pk);
}
public function whisper($from, $message){
$pk = new TextPacket();
$pk->type = TextPacket::TYPE_WHISPER;
$pk->source = $from instanceof Player ? $from->getDisplayName() : $from;
$pk->message = $message;
$this->dataPacket($pk);
}
/**
* Note for plugin developers: use kick() with the isAdmin

View File

@ -45,6 +45,7 @@ class TextPacket extends DataPacket{
switch($this->type){
case self::TYPE_POPUP:
case self::TYPE_CHAT:
case self::TYPE_WHISPER:
$this->source = $this->getString();
case self::TYPE_RAW:
case self::TYPE_TIP:
@ -67,6 +68,7 @@ class TextPacket extends DataPacket{
switch($this->type){
case self::TYPE_POPUP:
case self::TYPE_CHAT:
case self::TYPE_WHISPER:
$this->putString($this->source);
case self::TYPE_RAW:
case self::TYPE_TIP: