mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-12 06:25:32 +00:00
Added /me
This commit is contained in:
parent
026353399b
commit
82a789687c
@ -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…
x
Reference in New Issue
Block a user