From 82a789687c3c61eef3058b95ed2ca49811537fd3 Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Pueyo Date: Fri, 5 Apr 2013 15:13:17 +0200 Subject: [PATCH] Added /me --- src/API/ChatAPI.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/API/ChatAPI.php b/src/API/ChatAPI.php index 2aa157af..1e53971a 100644 --- a/src/API/ChatAPI.php +++ b/src/API/ChatAPI.php @@ -33,11 +33,20 @@ class ChatAPI{ public function init(){ $this->server->api->console->register("tell", "Sends a private message to a player", array($this, "commandHandler")); + $this->server->api->console->register("me", "Broadcast an action", array($this, "commandHandler")); } public function commandHandler($cmd, $params, $issuer, $alias){ $output = ""; switch($cmd){ + case "me": + if(!($issuer instanceof Player)){ + $sender = "Console"; + }else{ + $sender = $issuer->username; + } + $this->broadcast("* $sender ".implode(" ", $params)); + break; case "tell": if(!isset($params[0]) or !isset($params[1])){ $output .= "Usage: /$cmd \n";