From ee3c2605637ef62a6e1b2dd0ca08babc13d053b7 Mon Sep 17 00:00:00 2001 From: kremsy Date: Mon, 30 Dec 2013 13:21:41 +0100 Subject: [PATCH] added me command --- application/plugins/ChatMessagePlugin.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/application/plugins/ChatMessagePlugin.php b/application/plugins/ChatMessagePlugin.php index fabbae1c..43496db1 100644 --- a/application/plugins/ChatMessagePlugin.php +++ b/application/plugins/ChatMessagePlugin.php @@ -42,6 +42,7 @@ class ChatMessagePlugin implements CommandListener, Plugin { public function load(ManiaControl $maniaControl){ $this->maniaControl = $maniaControl; + $this->maniaControl->commandManager->registerCommandListener('me', $this, 'chat_me'); $this->maniaControl->commandManager->registerCommandListener('hi', $this, 'chat_hi'); $this->maniaControl->commandManager->registerCommandListener('bye', $this, 'chat_bye'); $this->maniaControl->commandManager->registerCommandListener('bb', $this, 'chat_bye'); @@ -75,6 +76,18 @@ class ChatMessagePlugin implements CommandListener, Plugin { } + /** + * Builds a chat message starting with the player's nickname, can used to express emotions + * @param array $chat + * @param Player $player + */ + public function chat_me(array $chat, Player $player){ + $message = substr($chat[1][2],3); + + $msg = '$<' . $player->nickname . '$>$s$i$fa0 ' . $message; + $this->maniaControl->chat->sendChat($msg, null, false); + } + /** * Hello Message * @param array $chat