mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Translate format text
This commit is contained in:
@ -42,10 +42,19 @@ class PlayerChatEvent extends PlayerEvent implements Cancellable{
|
||||
*/
|
||||
protected $recipients = [];
|
||||
|
||||
public function __construct(Player $player, $message, $format = "<%s> %s", array $recipients = null){
|
||||
public function __construct(Player $player, $message, $format = "chat.type.text", array $recipients = null){
|
||||
$this->player = $player;
|
||||
$this->message = $message;
|
||||
|
||||
//TODO: @deprecated (backwards-compativility)
|
||||
$i = 0;
|
||||
while(($pos = strpos($format, "%s")) !== false){
|
||||
$format = substr($format, 0, $pos) . "{%$i}" . substr($format, $pos + 2);
|
||||
++$i;
|
||||
}
|
||||
|
||||
$this->format = $format;
|
||||
|
||||
if($recipients === null){
|
||||
$this->recipients = Server::getInstance()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_USERS);
|
||||
}else{
|
||||
|
Reference in New Issue
Block a user