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; }
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; }
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; }
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"]); }
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); } }
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]"]); }
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); }
public function onJoin(PlayerJoinEvent $ev) { $player = $ev->getPlayer(); Cmd::exec($player, ["me has joined."]); Cmd::console($this->getServer(), []); }