Exemplo n.º 1
0
 public static function select(CmdSelModule $owner, CommandSender $sender, array $args)
 {
     $result = [];
     if (!isset($args["type"])) {
         $args["type"] = "player";
     }
     foreach ($owner->getServer()->getLevels() as $l) {
         foreach ($l->getEntities() as $e) {
             if (count($args) && !$owner->checkSelectors($args, $sender, $e)) {
                 continue;
             }
             if ($e instanceof Player) {
                 $result[] = $e->getName();
             } else {
                 $result[] = "e" . $e->getId();
             }
         }
     }
     if (!isset($args["c"])) {
         $args["c"] = 1;
     }
     $c = [];
     $n = intval($args["c"]);
     while ($n-- > 0 && count($result)) {
         $i = array_rand($result);
         $c[] = $result[$i];
         unset($result[$i]);
     }
     return $c;
 }
Exemplo n.º 2
0
 public static function select(CmdSelModule $owner, CommandSender $sender, array $args)
 {
     $result = [];
     foreach ($owner->getServer()->getOnlinePlayers() as $p) {
         if (count($args) && !$owner->checkSelectors($args, $sender, $p)) {
             continue;
         }
         $result[] = $p->getName();
     }
     return $result;
 }
Exemplo n.º 3
0
 public static function select(CmdSelModule $owner, CommandSender $sender, array $args)
 {
     $result = [];
     foreach ($owner->getServer()->getLevels() as $l) {
         foreach ($l->getEntities() as $e) {
             if (count($args) && !$owner->checkSelectors($args, $sender, $e)) {
                 continue;
             }
             if ($e instanceof Player) {
                 $result[] = $e->getName();
             } else {
                 $result[] = "e" . $e->getId();
             }
         }
     }
     return $result;
 }
Exemplo n.º 4
0
 public function onEnable()
 {
     if (!is_dir($this->getDataFolder())) {
         mkdir($this->getDataFolder());
     }
     mc::plugin_init($this, $this->getFile());
     $features = ["players" => ["CmdPlayers", true], "ops" => ["CmdOps", true], "gm?" => ["CmdGmx", true], "as" => ["CmdAs", true], "slay" => ["CmdSlay", true], "heal" => ["CmdHeal", true], "whois" => ["CmdWhois", true], "mute-unmute" => ["CmdMuteMgr", true], "freeze-thaw" => ["CmdFreezeMgr", true], "showtimings" => ["CmdTimings", true], "seeinv-seearmor" => ["CmdShowInv", true], "clearinv" => ["CmdClearInv", true], "get" => ["CmdGet", true], "shield" => ["CmdShieldMgr", true], "srvmode" => ["CmdSrvModeMgr", true], "opms-rpt" => ["CmdOpMsg", true], "entities" => ["CmdEntities", true], "after-at" => ["CmdAfterAt", true], "summon-dismiss" => ["CmdSummon", true], "pushtp-poptp" => ["CmdTpStack", true], "prefix" => ["CmdPrefixMgr", true], "spawn" => ["CmdSpawn", true], "burn" => ["CmdBurn", true], "blowup" => ["CmdBlowUp", true], "setarmor" => ["CmdSetArmor", true], "spectator" => ["CmdSpectator", false], "followers" => ["CmdFollowMgr", true], "rcon-client" => ["CmdRcon", true], "join-mgr" => ["JoinMgr", true], "repeater" => ["RepeatMgr", true], "broadcast-tp" => ["BcTpMgr", true], "crash" => ["CmdCrash", true], "pluginmgr" => ["CmdPluginMgr", true], "permmgr" => ["CmdPermMgr", true], "throw" => ["CmdThrow", true], "regmgr" => ["CmdRegMgr", true], "invisible" => ["CmdInvisible", true], "chat-utils" => ["CmdChatMgr", true], "query-hosts" => ["CmdQuery", true], "cmd-selector" => ["CmdSelMgr", true]];
     if (MPMU::apiVersion("1.12.0")) {
         $features["fly"] = ["CmdFly", true];
         $features["skinner"] = ["CmdSkinner", true];
         $features["blood-particles"] = ["BloodMgr", true];
         $ft = $this->getServer()->getPluginManager()->getPlugin("FastTransfer");
         if ($ft) {
             $features["broadcast-ft"] = ["TransferMgr", true];
         }
     }
     $cfg = $this->modConfig(__NAMESPACE__, $features, ["version" => $this->getDescription()->getVersion(), "rcon-client" => [], "query-hosts" => [], "join-mgr" => JoinMgr::defaults(), "broadcast-tp" => BcTpMgr::defaults(), "freeze-thaw" => CmdFreezeMgr::defaults(), "cmd-selector" => CmdSelMgr::defaults()]);
 }
Exemplo n.º 5
0
 public function onEnable()
 {
     $this->api = new GrabBagAPI($this);
     if (!is_dir($this->getDataFolder())) {
         mkdir($this->getDataFolder());
     }
     mc::plugin_init($this, $this->getFile());
     $this->getLogger()->info(mc::_("LibCommon v%1%", MPMU::version()));
     $features = ["players" => ["CmdPlayers", true], "ops" => ["CmdOps", true], "gm?" => ["CmdGmx", true], "as" => ["CmdAs", true], "slay" => ["CmdSlay", true], "heal" => ["CmdHeal", true], "whois" => ["CmdWhois", true], "mute-unmute" => ["CmdMuteMgr", true], "freeze-thaw" => ["CmdFreezeMgr", true], "showtimings" => ["CmdTimings", true], "seeinv-seearmor" => ["CmdShowInv", true], "clearinv" => ["CmdClearInv", true], "get" => ["CmdGet", true], "shield" => ["CmdShieldMgr", true], "srvmode" => ["CmdSrvModeMgr", true], "opms-rpt" => ["CmdOpMsg", true], "entities" => ["CmdEntities", true], "after-at" => ["CmdAfterAt", true], "summon-dismiss" => ["CmdSummon", true], "pushtp-poptp" => ["CmdTpStack", true], "prefix" => ["CmdPrefixMgr", true], "spawn" => ["CmdSpawn", true], "burn" => ["CmdBurn", true], "blowup" => ["CmdBlowUp", true], "setarmor" => ["CmdSetArmor", true], "spectator" => ["CmdSpectator", false], "followers" => ["CmdFollowMgr", true], "rcon-client" => [["ServerList", "CmdRcon"], true], "join-mgr" => ["JoinMgr", true], "custom-death" => ["CustomDeath", true], "repeater" => ["RepeatMgr", true], "broadcast-tp" => ["BcTpMgr", true], "crash" => ["CmdCrash", true], "pluginmgr" => ["CmdPluginMgr", true], "permmgr" => ["CmdPermMgr", true], "throw" => ["CmdThrow", true], "regmgr" => ["CmdRegMgr", true], "invisible" => ["CmdInvisible", true], "chat-utils" => ["CmdChatMgr", true], "query-hosts" => [["ServerList", "CmdQuery"], true], "cmd-selector" => ["CmdSelMgr", true], "cmd-alias" => ["CmdAlias", true], "reop" => ["CmdReOp", true], "tprequest" => ["CmdTpRequest", false], "homes" => ["CmdHomes", false], "warps" => ["CmdWarp", false], "motd-task" => [["ServerList", "MotdDaemon"], false], "query-task" => [["ServerList", "QueryDaemon"], false], "merge-slots" => [["ServerList", "MegaSlots"], false], "echo" => ["CmdEcho", true], "onevent-cmd" => ["CmdOnEvent", false], "pmscripts" => ["CmdRc", true], "event-tracer" => ["CmdTrace", false], "iteminfo" => ["CmdItemInfo", true], "plenty" => ["CmdPlenty", true], "wall" => [["ServerList", "CmdWall"], true], "afk" => ["CmdAFK", true], "xyz" => ["CmdXyz", true], "tptop" => ["CmdTpTop", true], "tpback" => ["CmdTpBack", true], "near" => ["CmdNear", true], "chat-scribe" => ["CmdSpy", true]];
     if (MPMU::apiVersion("1.12.0")) {
         $features["fly"] = ["CmdFly", true];
         $features["skinner"] = ["CmdSkinner", true];
         $features["blood-particles"] = ["BloodMgr", true];
         $ft = $this->getServer()->getPluginManager()->getPlugin("FastTransfer");
         if ($ft) {
             $features["broadcast-ft"] = ["TransferMgr", true];
             $features["ftservers"] = [["ServerList", "CmdFTServers"], true];
         }
     }
     $cfg = $this->modConfig(__NAMESPACE__, $features, ["version" => $this->getDescription()->getVersion(), "serverlist" => [], "join-mgr" => JoinMgr::defaults(), "broadcast-tp" => BcTpMgr::defaults(), "custom-death" => CustomDeath::defaults(), "freeze-thaw" => CmdFreezeMgr::defaults(), "cmd-selector" => CmdSelMgr::defaults(), "query-task" => QueryDaemon::defaults(), "motd-task" => MotdDaemon::defaults(), "chat-scribe" => CmdSpy::defaults()]);
 }