Overview

Namespaces

  • aliuly
    • common
      • selectors
    • loader
  • xPaw

Classes

  • aliuly\common\ArmorItems
  • aliuly\common\BasicCli
  • aliuly\common\BasicHelp
  • aliuly\common\BasicPlugin
  • aliuly\common\ChatSession
  • aliuly\common\Cmd
  • aliuly\common\CmdSelector
  • aliuly\common\ExpandVars
  • aliuly\common\FastTransfer
  • aliuly\common\FileUtils
  • aliuly\common\FreezeSession
  • aliuly\common\GetMotd
  • aliuly\common\GetMotdAsyncTask
  • aliuly\common\InvisibleSession
  • aliuly\common\InvUtils
  • aliuly\common\ItemName
  • aliuly\common\mc
  • aliuly\common\mc2
  • aliuly\common\MoneyAPI
  • aliuly\common\MPMU
  • aliuly\common\Npc
  • aliuly\common\PermUtils
  • aliuly\common\PluginAsyncTask
  • aliuly\common\PluginCallbackTask
  • aliuly\common\PMScript
  • aliuly\common\QueryAsyncTask
  • aliuly\common\Rcon
  • aliuly\common\RconTask
  • aliuly\common\selectors\All
  • aliuly\common\selectors\AllEntity
  • aliuly\common\selectors\BaseSelector
  • aliuly\common\selectors\Random
  • aliuly\common\Session
  • aliuly\common\ShieldSession
  • aliuly\common\ShoppingCart
  • aliuly\common\SignUtils
  • aliuly\common\SkinUtils
  • aliuly\common\SpySession
  • aliuly\common\SubCommandMap
  • aliuly\common\TPUtils
  • aliuly\loader\Main
  • xPaw\MinecraftQuery

Exceptions

  • xPaw\MinecraftQueryException
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace aliuly\common\selectors;
 3: 
 4: use pocketmine\command\CommandSender;
 5: use pocketmine\Server;
 6: 
 7: /**
 8:  * Base class for command selectors
 9:  */
10: abstract class BaseSelector {
11:   /**
12:    * Main entry point for command selectors
13:    */
14:   static public function select(Server $srv, CommandSender $sender, array $args) {
15:     throw \RuntimeException("Unimplemented select");
16:   }
17:   /**
18:    * Implement selectors like m, name, etc...
19:    */
20:   static public function checkSelectors(array $args,CommandSender $sender, Entity $item) {
21:     foreach($args as $name => $value){
22:       switch($name){
23:         case "m":
24:           $mode = intval($value);
25:           if($mode === -1) break;
26:           // what is the point of adding this (in PC) when they can just safely leave this out?
27:           if(($item instanceof Player) && ($mode !== $item->getGamemode())) return false;
28:           break;
29:         case "name":
30:           if ($value{0} === "!") {
31:             if(substr($value,1) === strtolower($item->getName())) return false;
32:           } else {
33:             if($value !== strtolower($item->getName())) return false;
34:           }
35:           break;
36:         case "w":
37:           // Non standard
38:           if ($value{0} === "!") {
39:             if(substr($value,1) === strtolower($item->getLevel()->getName())) return false;
40:           } else {
41:             if($value !== strtolower($item->getLevel()->getName())) return false;
42:           }
43:           break;
44:         case "type":
45:           if ($item instanceof Player) {
46:             $type = "player";
47:           } else {
48:             $type = strtolower($item->getSaveId());
49:           }
50:           if ($value{0} === "!") {
51:             if(substr($value,1) === $type) return false;
52:           } else {
53:             if($value !== $type) return false;
54:           }
55:           break;
56:           // x,y,z
57:           // r,rm
58:           // c
59:           // dx,dy,dz
60:           // rx,rxm
61:           // ry,rym
62:       }
63:     }
64:     return true;
65:   }
66: 
67: }
68: 
API documentation generated by ApiGen