Package com.mcbans.firestar.mcbans.request

Examples of com.mcbans.firestar.mcbans.request.Ban


        if (type != BanType.UNBAN){
            final Player target = Bukkit.getPlayerExact(targetName);
            targetIP = (target != null) ? target.getAddress().getAddress().getHostAddress() : "";
        }

        Ban banControl = new Ban(plugin, type.getActionName(), targetName, targetUUID, targetIP, senderName, senderUUID, reason, duration, measure, null, false);
        Thread triggerThread = new Thread(banControl);
        triggerThread.start();
    }
View Full Code Here


        if (args.size() > 0){
            reason = Util.join(args, " ");
        }

        // Start
        Ban banControl = new Ban(plugin, BanType.TEMP.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, duration, measure, null, false);
        Thread triggerThread = new Thread(banControl);
        triggerThread.start();
    }
View Full Code Here

        if (!type.getPermission().has(sender)){
            throw new CommandException(ChatColor.RED + _("permissionDenied"));
        }

        String reason = null;
        Ban banControl = null;
        switch (type){
            case LOCAL:
                reason = config.getDefaultLocal();
                if (args.size() > 0){
                    reason = Util.join(args, " ");
                }
                banControl = new Ban(plugin, type.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, "", "", null, false);
                break;

            case GLOBAL:
                if (args.size() == 0){
                    Util.message(sender, ChatColor.RED + _("formatError"));
                    return;
                }
                reason = Util.join(args, " ");
                banControl = new Ban(plugin, type.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, "", "", null, false);
                break;

            case TEMP:
                if (args.size() < 2){
                    Util.message(sender, ChatColor.RED + _("formatError"));
                    return;
                }
                String measure = "";
                String duration = args.remove(0);
                if(!duration.matches("(?sim)([0-9]+)(minute(s|)|m|hour(s|)|h|day(s|)|d|week(s|)|w)")){
                  measure = args.remove(0);
                }else{
                  try {
                    Pattern regex = Pattern.compile("([0-9]+)(minute(s|)|m|hour(s|)|h|day(s|)|d|week(s|)|w)", Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.MULTILINE);
                    Matcher regexMatcher = regex.matcher(duration);
                    if (regexMatcher.find()) {
                      duration = regexMatcher.group(1);
                      measure = regexMatcher.group(2);
                    }
                  } catch (PatternSyntaxException ex) {}
                }
                reason = config.getDefaultTemp();
                if (args.size() > 0){
                    reason = Util.join(args, " ");
                }
                banControl = new Ban(plugin, type.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, duration, measure, null, false);
                break;
        }

        // Start
        if (banControl == null){
View Full Code Here

        if (!plugin.getRbHandler().hasRollbackMethod()){
            throw new CommandException(ChatColor.RED + _("rbMethodNotFound"));
        }

        String reason = null;
        Ban banControl = null;
    switch (type){
            case LOCAL:
                reason = config.getDefaultLocal();
                if (args.size() > 0){
                    reason = Util.join(args, " ");
                }
                banControl = new Ban(plugin, type.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, "", "", (new JSONObject()), true);
                break;

            case GLOBAL:
                if (args.size() == 0){
                    Util.message(sender, ChatColor.RED + _("formatError"));
                    return;
                }
                reason = Util.join(args, " ");
                banControl = new Ban(plugin, type.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, "", "", (new JSONObject()), true);
                break;

            case TEMP:
                if (args.size() <= 2){
                    Util.message(sender, ChatColor.RED + _("formatError"));
                    return;
                }
                String measure = "";
                String duration = args.remove(0);
                if(!duration.matches("(?sim)([0-9]+)(minute(s|)|m|hour(s|)|h|day(s|)|d|week(s|)|w)")){
                  measure = args.remove(0);
                }else{
                  try {
                    Pattern regex = Pattern.compile("([0-9]+)(minute(s|)|m|hour(s|)|h|day(s|)|d|week(s|)|w)", Pattern.DOTALL | Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE | Pattern.MULTILINE);
                    Matcher regexMatcher = regex.matcher(duration);
                    if (regexMatcher.find()) {
                      duration = regexMatcher.group(1);
                      measure = regexMatcher.group(2);
                    }
                  } catch (PatternSyntaxException ex) {}
                }
                reason = config.getDefaultTemp();
                if (args.size() > 0){
                    reason = Util.join(args, " ");
                }
                banControl = new Ban(plugin, type.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, duration, measure, (new JSONObject()), true);
                break;
        }

        // Start
        if (banControl == null){
View Full Code Here

        // build reason
        String reason = Util.join(args, " ");
       
        // Start
        Ban banControl = new Ban(plugin, BanType.GLOBAL.getActionName(), target, targetUUID, targetIP, senderName, senderUUID, reason, "", "", null, false);
        Thread triggerThread = new Thread(banControl);
        triggerThread.start();
       
    }
View Full Code Here

    public void execute() throws CommandException {
      args.remove(0); // remove target
        //String target = args.get(0).trim(); already fetched in BaseCommand
       
        // Start
        Ban banControl = new Ban(plugin, BanType.UNBAN.getActionName(), target, targetUUID, "", senderName, senderUUID, "", "", "", null, false);
        Thread triggerThread = new Thread(banControl);
        triggerThread.start();
    }
View Full Code Here

TOP

Related Classes of com.mcbans.firestar.mcbans.request.Ban

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.