Exemple #1
0
 @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());
   }
 }
 @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;
 }
 @Override
 public boolean hasAccessPermission(final CommandSender sender) {
   return PermissionModule.hasPermission(sender, "crazytimecard.register");
 }
Exemple #5
0
 @Override
 @Permission("crazyspawner.mountme")
 public boolean hasAccessPermission(final CommandSender sender) {
   return PermissionModule.hasPermission(sender, "crazyspawner.mountme");
 }
Exemple #6
0
 @Override
 public boolean hasAccessPermission(final CommandSender sender) {
   return PermissionModule.hasPermission(sender, "crazylogin.login.command");
 }
 @Override
 public boolean hasAccessPermission(final CommandSender sender) {
   return PermissionModule.hasPermission(sender, "crazychats.coloredchat");
 }
 @Override
 @Permission("$CRAZYPLAYERDATAPLUGIN$.player.delete")
 public boolean hasAccessPermission(final CommandSender sender) {
   return PermissionModule.hasPermission(
       sender, plugin.getName().toLowerCase() + ".player.delete");
 }