mirror of
https://github.com/oldminecraftcommunity/NostalgiaCore.git
synced 2026-11-22 12:39:43 +00:00
Added /me
This commit is contained in:
parent
026353399b
commit
82a789687c
1 changed files with 9 additions and 0 deletions
|
|
@ -33,11 +33,20 @@ class ChatAPI{
|
||||||
|
|
||||||
public function init(){
|
public function init(){
|
||||||
$this->server->api->console->register("tell", "Sends a private message to a player", array($this, "commandHandler"));
|
$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){
|
public function commandHandler($cmd, $params, $issuer, $alias){
|
||||||
$output = "";
|
$output = "";
|
||||||
switch($cmd){
|
switch($cmd){
|
||||||
|
case "me":
|
||||||
|
if(!($issuer instanceof Player)){
|
||||||
|
$sender = "Console";
|
||||||
|
}else{
|
||||||
|
$sender = $issuer->username;
|
||||||
|
}
|
||||||
|
$this->broadcast("* $sender ".implode(" ", $params));
|
||||||
|
break;
|
||||||
case "tell":
|
case "tell":
|
||||||
if(!isset($params[0]) or !isset($params[1])){
|
if(!isset($params[0]) or !isset($params[1])){
|
||||||
$output .= "Usage: /$cmd <player> <message>\n";
|
$output .= "Usage: /$cmd <player> <message>\n";
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue