From bbed280f62877393119bf9526f3f837fc13e1b9c Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 6 Aug 2019 21:50:05 -0400 Subject: [PATCH] Update docs links to point to enginehub. Also don't allow block-place/block-break setting from flag helper. --- README.md | 2 +- .../src/main/resources/defaults/blacklist.txt | 2 +- .../worldguard/commands/region/FlagHelperBox.java | 11 +++++++++-- .../worldguard/commands/region/RegionCommands.java | 8 ++++---- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 183cbbe8..0ab5124b 100644 --- a/README.md +++ b/README.md @@ -43,4 +43,4 @@ Links * [IRC channel](https://webchat.esper.net/?join=sk89q) (#sk89q on irc.esper.net) * [Issue tracker](https://dev.enginehub.org/issues/WORLDGUARD) * [Continuous integration](http://builds.enginehub.org) [![Build Status](https://ci.enginehub.org/app/rest/builds/buildType:bt11,branch:master/statusIcon.svg)](http://ci.enginehub.org/viewType.html?buildTypeId=bt11&guest=1) -* [End-user documentation](https://worldguard.readthedocs.io/en/latest/) +* [End-user documentation](https://worldguard.enginehub.org/en/latest/) diff --git a/worldguard-bukkit/src/main/resources/defaults/blacklist.txt b/worldguard-bukkit/src/main/resources/defaults/blacklist.txt index a07469ae..852f0bca 100644 --- a/worldguard-bukkit/src/main/resources/defaults/blacklist.txt +++ b/worldguard-bukkit/src/main/resources/defaults/blacklist.txt @@ -42,7 +42,7 @@ ############################################################################### # # For more information, see: -# https://worldguard.readthedocs.io/en/latest/blacklist/ +# https://worldguard.enginehub.org/en/latest/blacklist/ # ############################################################################### # diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/FlagHelperBox.java b/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/FlagHelperBox.java index d7be880c..d9910112 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/FlagHelperBox.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/FlagHelperBox.java @@ -76,6 +76,7 @@ class FlagHelperBox extends PaginationBox { .collect(Collectors.toList()); private static final int SIZE = FLAGS.size() == Flags.INBUILT_FLAGS.size() ? FLAGS.size() : FLAGS.size() + 1; private static final int PAD_PX_SIZE = 180; + private static final Set> DANGER_ZONE = ImmutableSet.of(Flags.BUILD, Flags.PASSTHROUGH, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK); private final World world; private final ProtectedRegion region; @@ -200,7 +201,13 @@ private void appendValueChoices(TextComponent.Builder builder, Flag flag, if (maySet) { if (isExplicitSet) { hoverTexts.add(TextComponent.of("Click to unset", TextColor.GOLD)); - } else if (flag != Flags.BUILD && flag != Flags.PASSTHROUGH) { + } else if (DANGER_ZONE.contains(flag)) { + hoverTexts.add(TextComponent.of("Setting this flag may have unintended consequences.", TextColor.RED) + .append(TextComponent.newline()) + .append(TextComponent.of("Please read the documentation and set this flag manually if you really intend to.") + .append(TextComponent.newline()) + .append(TextComponent.of("(Hint: You do not need to set this to protect the region!)")))); + } else { hoverTexts.add(TextComponent.of("Click to set", TextColor.GOLD)); } } @@ -221,7 +228,7 @@ private void appendValueChoices(TextComponent.Builder builder, Flag flag, HoverEvent.of(HoverEvent.Action.SHOW_TEXT, hoverBuilder.build())); } - if (maySet && (isExplicitSet || flag != Flags.BUILD && flag != Flags.PASSTHROUGH)) { + if (maySet && (isExplicitSet || !DANGER_ZONE.contains(flag))) { builder.append(choiceComponent.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND, makeCommand(flag, isExplicitSet ? "" : choice)))); } else { diff --git a/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/RegionCommands.java b/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/RegionCommands.java index ee51a8dc..2a3a2cce 100644 --- a/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/RegionCommands.java +++ b/worldguard-core/src/main/java/com/sk89q/worldguard/commands/region/RegionCommands.java @@ -539,10 +539,10 @@ public void flag(CommandContext args, Actor sender) throws CommandException { .append(TextComponent.of("Only set this flag if you are sure you know what you are doing. See ") .append(TextComponent.of("[this documentation page]", TextColor.AQUA) .clickEvent(ClickEvent.of(ClickEvent.Action.OPEN_URL, - "https://worldguard.readthedocs.io/en/latest/regions/flags/#protection-related"))) + "https://worldguard.enginehub.org/en/latest/regions/flags/#protection-related"))) .append(TextComponent.of(" for more info.")))); if (!sender.isPlayer()) { - sender.printRaw("https://worldguard.readthedocs.io/en/latest/regions/flags/#protection-related"); + sender.printRaw("https://worldguard.enginehub.org/en/latest/regions/flags/#protection-related"); } } else if (foundFlag == Flags.PASSTHROUGH) { sender.print(TextComponent.empty().append(TextComponent.of("WARNING:", TextColor.RED, Sets.newHashSet(TextDecoration.BOLD))) @@ -551,10 +551,10 @@ public void flag(CommandContext args, Actor sender) throws CommandException { .append(TextComponent.of("It overrides build checks. If you're unsure what this means, see ") .append(TextComponent.of("[this documentation page]", TextColor.AQUA) .clickEvent(ClickEvent.of(ClickEvent.Action.OPEN_URL, - "https://worldguard.readthedocs.io/en/latest/regions/flags/#overrides"))) + "https://worldguard.enginehub.org/en/latest/regions/flags/#overrides"))) .append(TextComponent.of(" for more info.")))); if (!sender.isPlayer()) { - sender.printRaw("https://worldguard.readthedocs.io/en/latest/regions/flags/#overrides"); + sender.printRaw("https://worldguard.enginehub.org/en/latest/regions/flags/#overrides"); } } }