mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2025-02-15 03:41:24 +01:00
Merge pull request #304 from stuntguy3000/master
Add silent (s) and information (i) flags to /stoplag.
This commit is contained in:
commit
46138c9abe
@ -98,12 +98,21 @@ 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 = "cis", max = 0)
|
||||
@CommandPermissions({"worldguard.halt-activity"})
|
||||
public void stopLag(CommandContext args, CommandSender sender) throws CommandException {
|
||||
|
||||
ConfigurationManager configManager = plugin.getGlobalStateManager();
|
||||
|
||||
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('c');
|
||||
|
||||
if (configManager.activityHaltToggle) {
|
||||
@ -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.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user