Translate format text

This commit is contained in:
Shoghi Cervantes
2015-04-11 02:15:46 +02:00
parent 0c041ebca3
commit c29ae333a2
8 changed files with 42 additions and 32 deletions

View File

@ -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{