コード例 #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);
 }
コード例 #2
0
 @Override
 @Localized({
   "CRAZYTIMECARD.COMMAND.REGISTER.HEADER $CurrentPage$ $MaxPage$ $ChatHeader$ $DateTime$",
   "CRAZYTIMECARD.COMMAND.REGISTER.LISTFORMAT $Index$ $Entry$ $ChatHeader$"
 })
 public void command(final CommandSender sender, final String[] args) throws CrazyException {
   final Map<String, Paramitrisable> params = new TreeMap<String, Paramitrisable>();
   final StringParamitrisable card = new StringParamitrisable(null);
   params.put("", card);
   params.put("c", card);
   params.put("card", card);
   final StringParamitrisable owner = new StringParamitrisable(sender.getName());
   params.put("o", owner);
   params.put("owner", owner);
   final DurationParamitrisable duration = new DurationParamitrisable(plugin.getDefaultDuration());
   params.put("d", duration);
   params.put("duration", duration);
   final IntegerParamitrisable amount = new IntegerParamitrisable(1);
   params.put("a", amount);
   params.put("amount", amount);
   ChatHelperExtended.readParameters(args, params);
   final ArrayList<String> cards = new ArrayList<String>(amount.getValue());
   if (card.getValue() == null)
     for (int i = 0; i < amount.getValue(); i++) cards.add(plugin.genCardKey());
   else for (int i = 0; i < amount.getValue(); i++) cards.add(card.getValue() + "_" + i);
   final Database<CardData> database = plugin.getCardDatabase();
   for (int i = 0; i < amount.getValue(); i++)
     database.save(new CardData(cards.get(i), owner.getValue(), duration.getValue()));
   plugin.sendLocaleList(
       sender, "COMMAND.REGISTER.HEADER", "COMMAND.REGISTER.LISTFORMAT", null, -1, 1, cards);
 }
コード例 #3
0
ファイル: CommandMountMe.java プロジェクト: Nymphx/Crazy
 @Override
 @Permission({
   "crazyspawner.mountme.self",
   "crazyspawner.mountme.others",
   "crazyspawner.mountme.*",
   "crazyspawner.mountme.<ENTITYTYPE>.*",
   "crazyspawner.mountme.<CUSTOMENTITYNAME>"
 })
 @Localized({
   "CRAZYSPAWNER.COMMAND.MOUNTME.SELF $EntityType$",
   "CRAZYSPAWNER.COMMAND.MOUNTME.OTHER $EntityType$ $MountedPlayer$",
   "CRAZYSPAWNER.COMMAND.MOUNTME.MOUNTED $EntityType$ $Sender$"
 })
 public void command(final CommandSender sender, final String[] args) throws CrazyException {
   final Map<String, TabbedParamitrisable> params = new TreeMap<String, TabbedParamitrisable>();
   final NamedEntitySpawnerParamitrisable spawnerParam =
       new NamedEntitySpawnerParamitrisable((NamedEntitySpawner) null);
   params.put("c", spawnerParam);
   params.put("creature", spawnerParam);
   params.put("e", spawnerParam);
   params.put("entity", spawnerParam);
   final PlayerParamitrisable playerParam = new PlayerParamitrisable(sender);
   params.put("p", playerParam);
   params.put("plr", playerParam);
   params.put("player", playerParam);
   ChatHelperExtended.readParameters(args, params, spawnerParam, playerParam);
   final NamedEntitySpawner spawner = spawnerParam.getValue();
   if (spawner == null)
     throw new CrazyCommandUsageException("<entity:NamedEntityType> [player:Player]");
   final Player player = playerParam.getValue();
   if (player == null)
     throw new CrazyCommandUsageException("<entity:NamedEntityType> <player:Player>");
   if (!PermissionModule.hasPermission(
       sender, "crazyspawner.mountme." + (player == sender ? "self" : "others")))
     throw new CrazyCommandPermissionException();
   if (!(PermissionModule.hasPermission(sender, "crazyspawner.mountme.*")
       || PermissionModule.hasPermission(
           sender, "crazyspawner.mountme." + spawner.getType().name() + ".*")
       || PermissionModule.hasPermission(sender, "crazyspawner.mountme." + spawner.getName())))
     throw new CrazyCommandPermissionException();
   Entity entity = spawner.spawn(player.getLocation());
   while (entity.getPassenger() != null) entity = entity.getPassenger();
   entity.setPassenger(player);
   if (player == sender)
     plugin.sendLocaleMessage(
         "COMMAND.MOUNTME.SELF", sender, spawnerParam.getValue().getType().name());
   else {
     plugin.sendLocaleMessage(
         "COMMAND.MOUNTME.OTHER",
         sender,
         spawnerParam.getValue().getType().name(),
         player.getName());
     plugin.sendLocaleMessage(
         "COMMAND.MOUNTME.MOUNTED",
         sender,
         spawnerParam.getValue().getType().name(),
         sender.getName());
   }
 }
コード例 #4
0
ファイル: CommandMountMe.java プロジェクト: Nymphx/Crazy
 @Override
 public List<String> tab(final CommandSender sender, final String[] args) {
   final Map<String, TabbedParamitrisable> params = new TreeMap<String, TabbedParamitrisable>();
   final NamedEntitySpawnerParamitrisable entityParam =
       new NamedEntitySpawnerParamitrisable((NamedEntitySpawner) null);
   params.put("c", entityParam);
   params.put("creature", entityParam);
   params.put("e", entityParam);
   params.put("entity", entityParam);
   final PlayerParamitrisable playerParam = new PlayerParamitrisable(sender);
   params.put("p", playerParam);
   params.put("plr", playerParam);
   params.put("player", playerParam);
   return ChatHelperExtended.tabHelp(args, params, entityParam, playerParam);
 }
コード例 #5
0
 @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;
 }