added me command

This commit is contained in:
kremsy 2013-12-30 13:21:41 +01:00
parent 144f561203
commit ee3c260563

View File

@ -42,6 +42,7 @@ class ChatMessagePlugin implements CommandListener, Plugin {
public function load(ManiaControl $maniaControl){ public function load(ManiaControl $maniaControl){
$this->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('hi', $this, 'chat_hi');
$this->maniaControl->commandManager->registerCommandListener('bye', $this, 'chat_bye'); $this->maniaControl->commandManager->registerCommandListener('bye', $this, 'chat_bye');
$this->maniaControl->commandManager->registerCommandListener('bb', $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 * Hello Message
* @param array $chat * @param array $chat