Handler_playtimepromote.promotionTask.cancel();
Handler_playtimepromote.promotionTask = CommandsEX.plugin.getServer().getScheduler().runTaskTimerAsynchronously(CommandsEX.plugin, new Runnable() {
@Override
public void run() {
// create ExecutorService to manage threads
ExecutorService threadExecutor = Executors.newFixedThreadPool(1);
threadExecutor.execute(new Runnable() {
@Override
public void run() {
Handler_playtimepromote.checkTimedPromotions();
}
});
threadExecutor.shutdown(); // shutdown worker threads
}
}, (20 * Integer.parseInt(args[2])), (20 * Integer.parseInt(args[2])));
} catch (Throwable ex) {}
// show message
sender.sendMessage(ChatColor.YELLOW + _("configUpdated", sender.getName()) + ChatColor.WHITE + p.getConfig().getString("timedPromoteTaskTime"));
} else {
// timeout not numeric
LogHelper.showWarning("configProvideNumericValue", sender);
}
} else {
LogHelper.showWarnings(sender, "configUnspecifiedError1", "configUnspecifiedError2", "configUnspecifiedError3");
}
} else if (v.equals("ecopromotetasktime")) {
if ((aLength > 2) && (args[0].equals("cs") ? args[2].toLowerCase() : args[3].toLowerCase()) != null) {
if ((args[0].equals("cs") ? args[2].toLowerCase() : args[3].toLowerCase()).matches(CommandsEX.intRegex)) {
p.getConfig().set("ecoPromoteTaskTime", Integer.valueOf((args[0].equals("cs") ? args[2].toLowerCase() : args[3].toLowerCase())));
p.saveConfig();
// cancel old task and create a new one with this new timeout value
try {
Handler_economypromote.promotionTask.cancel();
Handler_economypromote.promotionTask = CommandsEX.plugin.getServer().getScheduler().runTaskTimerAsynchronously(CommandsEX.plugin, new Runnable() {
@Override
public void run() {
// create ExecutorService to manage threads
ExecutorService threadExecutor = Executors.newFixedThreadPool(1);
threadExecutor.execute(new Runnable() {
@Override
public void run() {
Handler_economypromote.checkTimedPromotions();
}
});
threadExecutor.shutdown(); // shutdown worker threads
}
}, (20 * Integer.parseInt((args[0].equals("cs") ? args[2].toLowerCase() : args[3].toLowerCase()))), (20 * Integer.parseInt((args[0].equals("cs") ? args[2].toLowerCase() : args[3].toLowerCase()))));
} catch (Throwable ex) {}
// show message