mirror of
https://github.com/EngineHub/WorldGuard.git
synced 2024-12-27 03:27:39 +01:00
Fix activityHaltToggle in /stoplag
This commit is contained in:
parent
b27f18788c
commit
71df9c0011
@ -115,31 +115,33 @@ public void stopLag(CommandContext args, Actor sender) throws CommandException {
|
|||||||
sender.print("ALL intensive server activity is allowed.");
|
sender.print("ALL intensive server activity is allowed.");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
configManager.activityHaltToggle = !args.hasFlag('c');
|
boolean activityHaltToggle = !args.hasFlag('c');
|
||||||
|
|
||||||
if (configManager.activityHaltToggle) {
|
if (activityHaltToggle && (args.argsLength() == 0 || !args.getString(0).equalsIgnoreCase("confirm"))) {
|
||||||
if (args.argsLength() == 0 || !args.getString(0).equalsIgnoreCase("confirm")) {
|
String confirmCommand = "/" + args.getCommand() + " confirm";
|
||||||
String confirmCommand = "/" + args.getCommand() + " confirm";
|
|
||||||
|
|
||||||
TextComponent message = TextComponent.builder("")
|
TextComponent message = TextComponent.builder("")
|
||||||
.append(ErrorFormat.wrap("This command will "))
|
.append(ErrorFormat.wrap("This command will "))
|
||||||
.append(ErrorFormat.wrap("PERMANENTLY")
|
.append(ErrorFormat.wrap("PERMANENTLY")
|
||||||
.decoration(TextDecoration.BOLD, TextDecoration.State.TRUE))
|
.decoration(TextDecoration.BOLD, TextDecoration.State.TRUE))
|
||||||
.append(ErrorFormat.wrap(" erase ALL animals in ALL loaded chunks in ALL loaded worlds. "))
|
.append(ErrorFormat.wrap(" erase ALL animals in ALL loaded chunks in ALL loaded worlds. "))
|
||||||
.append(Component.newline())
|
.append(Component.newline())
|
||||||
.append(TextComponent.of("[Click]", TextColor.GREEN)
|
.append(TextComponent.of("[Click]", TextColor.GREEN)
|
||||||
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, confirmCommand))
|
.clickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, confirmCommand))
|
||||||
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to confirm /" + args.getCommand()))))
|
.hoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, TextComponent.of("Click to confirm /" + args.getCommand()))))
|
||||||
.append(ErrorFormat.wrap(" or type "))
|
.append(ErrorFormat.wrap(" or type "))
|
||||||
.append(CodeFormat.wrap(confirmCommand)
|
.append(CodeFormat.wrap(confirmCommand)
|
||||||
.clickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, confirmCommand)))
|
.clickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, confirmCommand)))
|
||||||
.append(ErrorFormat.wrap(" to confirm."))
|
.append(ErrorFormat.wrap(" to confirm."))
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
sender.print(message);
|
sender.print(message);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configManager.activityHaltToggle = activityHaltToggle;
|
||||||
|
|
||||||
|
if (activityHaltToggle) {
|
||||||
if (!(sender instanceof LocalPlayer)) {
|
if (!(sender instanceof LocalPlayer)) {
|
||||||
sender.print("ALL intensive server activity halted.");
|
sender.print("ALL intensive server activity halted.");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user