use of com.mcsimonflash.sponge.cmdscheduler.task.CommandTask in project CmdScheduler by SimonFlash.
the class Stop method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
CommandTask task = args.<CommandTask>getOne("task").get();
task.getTask().stop(CmdScheduler.get().getContainer());
src.sendMessage(Text.of("Successfully stopped task " + task.getName() + "."));
return CommandResult.success();
}
use of com.mcsimonflash.sponge.cmdscheduler.task.CommandTask in project CmdScheduler by SimonFlash.
the class Config method loadTask.
public static void loadTask(ConfigurationNode node) {
try {
String name = (String) node.getKey();
String command = node.getNode("command").getString("");
Schedule schedule = getSchedule(node.getNode("schedule"));
Tristate async = node.getNode("async").isVirtual() ? Tristate.UNDEFINED : Tristate.fromBoolean(node.getNode("async").getBoolean(false));
tasks.put(name.toLowerCase(), new CommandTask(name, command.startsWith("/") ? command.substring(1) : command, schedule, async));
} catch (IllegalArgumentException e) {
CmdScheduler.get().getLogger().error(e.getMessage());
}
}
use of com.mcsimonflash.sponge.cmdscheduler.task.CommandTask in project CmdScheduler by SimonFlash.
the class Execute method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
CommandTask task = args.<CommandTask>getOne("task").get();
task.getTask().execute(CmdScheduler.get().getContainer());
src.sendMessage(Text.of("Successfully executed task " + task.getName() + "."));
return CommandResult.success();
}
use of com.mcsimonflash.sponge.cmdscheduler.task.CommandTask in project CmdScheduler by SimonFlash.
the class Start method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
CommandTask task = args.<CommandTask>getOne("task").get();
task.getTask().start(CmdScheduler.get().getContainer());
src.sendMessage(Text.of("Successfully started task " + task.getName() + "."));
return CommandResult.success();
}
use of com.mcsimonflash.sponge.cmdscheduler.task.CommandTask in project CmdScheduler by SimonFlash.
the class Delete method execute.
@Override
public CommandResult execute(CommandSource src, CommandContext args) {
CommandTask task = args.<CommandTask>getOne("task").get();
task.getTask().stop(CmdScheduler.get().getContainer());
Config.tasks.remove(task.getName().toLowerCase());
src.sendMessage(Text.of("Deleted task " + task.getName() + ". If this task was defined in the config, it must be removed manually."));
return CommandResult.success();
}
Aggregations