Changed halt-activity: Added Silent (s) and Information (i) flags, Added Resume (r) flag, remove c flag.

This commit is contained in:
Luke Anderson (stuntguy3000) 2014-01-26 12:00:08 +10:30
parent 2df3290d38
commit 9c7fb6a1d3

View File

@ -98,13 +98,22 @@ public void allowFire(CommandContext args, CommandSender sender) throws CommandE
}
@Command(aliases = {"halt-activity", "stoplag", "haltactivity"},
desc = "Attempts to cease as much activity in order to stop lag", flags = "c", max = 0)
desc = "Attempts to cease as much activity in order to stop lag", flags = "ris", max = 0)
@CommandPermissions({"worldguard.halt-activity"})
public void stopLag(CommandContext args, CommandSender sender) throws CommandException {
ConfigurationManager configManager = plugin.getGlobalStateManager();
configManager.activityHaltToggle = !args.hasFlag('c');
if (args.hasFlag('i')) {
if (configManager.activityHaltToggle) {
sender.sendMessage(ChatColor.YELLOW
+ "ALL intensive server activity is not allowed.");
} else {
sender.sendMessage(ChatColor.YELLOW
+ "ALL intensive server activity is allowed.");
}
} else {
configManager.activityHaltToggle = !args.hasFlag('r');
if (configManager.activityHaltToggle) {
if (!(sender instanceof Player)) {
@ -112,9 +121,15 @@ public void stopLag(CommandContext args, CommandSender sender) throws CommandExc
+ "ALL intensive server activity halted.");
}
if (!args.hasFlag('s')) {
plugin.getServer().broadcastMessage(ChatColor.YELLOW
+ "ALL intensive server activity halted by "
+ plugin.toName(sender) + ".");
} else {
sender.sendMessage(ChatColor.YELLOW
+ "(Silent) ALL intensive server activity halted by "
+ plugin.toName(sender) + ".");
}
for (World world : plugin.getServer().getWorlds()) {
int removed = 0;
@ -131,15 +146,20 @@ public void stopLag(CommandContext args, CommandSender sender) throws CommandExc
+ world.getName());
}
}
} else {
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.YELLOW
+ "ALL intensive server activity no longer halted.");
}
if (!args.hasFlag('s')) {
plugin.getServer().broadcastMessage(ChatColor.YELLOW
+ "ALL intensive server activity is now allowed.");
if (!(sender instanceof Player)) {
sender.sendMessage(ChatColor.YELLOW
+ "ALL intensive server activity is now allowed.");
}
} else {
sender.sendMessage(ChatColor.YELLOW
+ "(Silent) ALL intensive server activity is now allowed.");
}
}
}
}
}