Exemple #1
0
 protected function onRun(array $args, User $user)
 {
     if (!isset($args[1])) {
         $page = isset($args[0]) ? (int) $args[0] + 1 : 1;
         return HereAuth::page($this->getHelpMessage($user), $page);
     }
     $opts = $user->getAccountInfo()->opts;
     $type = array_shift($args);
     $value = array_shift($args);
     $boolVal = $this->parseBool($value);
     $action = $boolVal ? "Enabled" : "Disabled";
     switch ($type) {
         case "autosecret":
         case "as":
             if (!$user->getPlayer()->hasPermission("hereauth.auth.autoauth.clientsecret")) {
                 return "You don't have permission to do this!";
             }
             $opts->autoSecret = $boolVal;
             return "{$action} client secret AutoAuth";
         case "autouuid":
         case "au":
             if (!$user->getPlayer()->hasPermission("hereauth.auth.autoauth.uuid")) {
                 return "You don't have permission to do this!";
             }
             $opts->autoUuid = $boolVal;
             return "{$action} UUID AutoAuth";
         case "autoip":
         case "ai":
             if (!$user->getPlayer()->hasPermission("hereauth.auth.autoauth.ip")) {
                 return "You don't have permission to do this!";
             }
             $opts->autoIp = $boolVal;
             return "{$action} IP AutoAuth";
         case "maskloc":
         case "ml":
             if (!$user->getPlayer()->hasPermission("hereauth.auth.masking.location.toggle")) {
                 return "You don't have permission to do this!";
             }
             $opts->maskLoc = $boolVal;
             return "{$action} location masking";
         case "maskinv":
         case "mi":
             if (!$user->getPlayer()->hasPermission("hereauth.auth.masking.inventory")) {
                 return "You don't have permission to do this!";
             }
             $opts->maskInv = $boolVal;
             return "{$action} inventory masking";
         case "mafskin":
         case "mafs":
             if (!$user->getPlayer()->hasPermission("hereauth.auth.multiauth.skin")) {
                 return "You don't have permission to do this!";
             }
             $opts->multiSkin = $boolVal;
             return "{$action} skin MAF";
         case "mafip":
         case "mafi":
             if (!$user->getPlayer()->hasPermission("hereauth.auth.multiauth.ip")) {
                 return "You don't have permission to do this!";
             }
             $opts->multiIp = $boolVal;
             return "{$action} IP MAF";
     }
     return "Unknown option \"{$type}\"";
 }