示例#1
0
 @Override
 @Localized("CRAZYLOGIN.COMMAND.REGISTER.WARNCONFIRMPASSWORDDISABLED")
 public void command(final CommandSender sender, final String[] args) throws CrazyException {
   if (!(sender instanceof Player)) throw new CrazyCommandExecutorException(false);
   final Player player = (Player) sender;
   if (!plugin.isLoggedIn(player) && plugin.hasPlayerData(player))
     throw new CrazyCommandPermissionException();
   if (!plugin.hasPlayerData(player))
     if (!PermissionModule.hasPermission(player, "crazylogin.register.command"))
       throw new CrazyCommandPermissionException();
   String password = null;
   if (plugin.isConfirmPasswordEnabled()) {
     if (args.length % 2 == 1) throw new CrazyCommandUsageException("<Password> <Password>");
     password = ChatHelper.listingString(" ", ChatHelperExtended.cutArray(args, args.length / 2));
     if (!password.equals(
         ChatHelper.listingString(" ", ChatHelperExtended.shiftArray(args, args.length / 2))))
       throw new CrazyCommandUsageException("<Password> <Password>");
   } else password = ChatHelper.listingString(" ", args);
   plugin.playerPassword(player, password);
   if (!plugin.isConfirmPasswordEnabled())
     if (args.length % 2 == 0)
       if (ChatHelper.listingString(" ", ChatHelperExtended.cutArray(args, args.length / 2))
           .equals(
               ChatHelper.listingString(
                   " ", ChatHelperExtended.shiftArray(args, args.length / 2))))
         plugin.sendLocaleMessage("COMMAND.REGISTER.WARNCONFIRMPASSWORDDISABLED", player);
 }
 @Override
 @Localized({
   "CRAZYLOGIN.COMMAND.DROPOLDDATA.DELETEWARN $Name$ $KeptDays$",
   "CRAZYLOGIN.COMMAND.DROPOLDDATA.DELETED $DropCauser$ $KeptDays$ $DroppedAmount$"
 })
 public void command(final CommandSender sender, final String[] args) throws CrazyException {
   if (!PermissionModule.hasPermission(sender, "crazylogin.dropolddata")) {
     String days = "(-)";
     if (args.length != 0) days = args[0];
     plugin.broadcastLocaleMessage(
         true, "crazylogin.warndelete", "COMMANDS.DROPOLDDATA.DELETEWARN", sender.getName(), days);
     throw new CrazyCommandPermissionException();
   }
   if (args.length < 2)
     if (sender instanceof ConsoleCommandSender)
       throw new CrazyCommandUsageException("<DaysToKeep> CONSOLE_CONFIRM");
     else throw new CrazyCommandUsageException("<DaysToKeep> <Password>");
   int days = 0;
   try {
     days = Integer.parseInt(args[0]);
   } catch (final NumberFormatException e) {
     throw new CrazyCommandParameterException(0, "Number (Integer)");
   }
   if (days < 0) return;
   final String password = ChatHelper.listingString(" ", ChatHelperExtended.shiftArray(args, 1));
   if (sender instanceof ConsoleCommandSender) {
     if (!password.equals("CONSOLE_CONFIRM"))
       throw new CrazyCommandUsageException("<DaysToKeep> CONSOLE_CONFIRM");
   } else {
     if (!plugin.getPlayerData((Player) sender).isPassword(password))
       throw new CrazyCommandUsageException("<DaysToKeep> <Password>");
   }
   final int amount = plugin.dropInactiveAccounts(days);
   plugin.broadcastLocaleMessage(
       true,
       "crazylogin.warndelete",
       true,
       "COMMAND.DROPOLDDATA.DELETED",
       sender.getName(),
       days,
       amount);
   return;
 }