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){