Exemplo n.º 1
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     $cmdline = $this->cmd;
     if (count($args)) {
         $cmdline .= " " . implode(" ", $args);
     }
     Cmd::exec($sender, [$cmdline], false);
     return true;
 }
Exemplo n.º 2
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "give":
             Cmd::exec($sender, ["gift " . implode(" ", $args)], false);
             return true;
     }
     return false;
 }
Exemplo n.º 3
0
 public function onCommand(CommandSender $sender, Command $cmd, $label, array $args)
 {
     switch ($cmd->getName()) {
         case "list":
             Cmd::exec($sender, ["query list"], false);
             return true;
     }
     return false;
 }
Exemplo n.º 4
0
 public function onJoin(PlayerJoinEvent $ev)
 {
     $player = $ev->getPlayer();
     Cmd::exec($player, ["me has joined.", "me is really wonderful."]);
     Cmd::console($this->getServer(), ["give " . $player->getName() . " gold_ingot"]);
 }
Exemplo n.º 5
0
 public function dispatchEvent($n, $ev)
 {
     if ($this->listeners[$n]["command"] === null) {
         return;
     }
     $cmdline = $this->listeners[$n]["command"];
     if (is_callable([$ev, "getPlayer"])) {
         $ctx = $ev->getPlayer();
     } elseif (is_callable([$ev, "getEntity"]) && $ev->getEntity() instanceof Player) {
         $ctx = $ev->getEntity();
     } else {
         $ctx = new ConsoleCommandSender();
     }
     if (($rc = $this->owner->getModule("pmscripts")) !== null) {
         $rc->setEnv("event", $ev);
         Cmd::opexec($ctx, $cmdline);
         $rc->unsetEnv("event");
     } else {
         Cmd::opexec($ctx, $cmdline);
     }
 }
Exemplo n.º 6
0
 public function onEnable()
 {
     Cmd::addCommand($this, $this, "sp", ["description" => "Sends popup to player", "usage" => "/sp <player> [message]"]);
     Cmd::addCommand($this, $this, "st", ["description" => "Sends tip to player", "usage" => "/st <player> [message]"]);
 }
Exemplo n.º 7
0
 public function dispatchEvent($n, $ev)
 {
     if ($this->listeners[$n]["command"] === null) {
         return;
     }
     if (is_callable([$ev, "getPlayer"])) {
         $ctx = $ev->getPlayer();
     } elseif (is_callable([$ev, "getEntity"]) && $ev->getEntity() instanceof Player) {
         $ctx = $ev->getEntity();
     } else {
         $ctx = new ConsoleCommandSender();
     }
     Cmd::opexec($ctx, $cmdline);
 }
Exemplo n.º 8
0
 public function onJoin(PlayerJoinEvent $ev)
 {
     $player = $ev->getPlayer();
     Cmd::exec($player, ["me has joined."]);
     Cmd::console($this->getServer(), []);
 }