Skip to content

Commit

Permalink
Update docs links to point to enginehub.
Browse files Browse the repository at this point in the history
Also don't allow block-place/block-break setting from flag helper.
  • Loading branch information
wizjany committed Aug 7, 2019
1 parent f165ae3 commit bbed280
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -43,4 +43,4 @@ Links
* [IRC channel](https://webchat.esper.net/?join=sk89q) (#sk89q on irc.esper.net) * [IRC channel](https://webchat.esper.net/?join=sk89q) (#sk89q on irc.esper.net)
* [Issue tracker](https://dev.enginehub.org/issues/WORLDGUARD) * [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) * [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/)
Expand Up @@ -42,7 +42,7 @@
############################################################################### ###############################################################################
# #
# For more information, see: # For more information, see:
# https://worldguard.readthedocs.io/en/latest/blacklist/ # https://worldguard.enginehub.org/en/latest/blacklist/
# #
############################################################################### ###############################################################################
# #
Expand Down
Expand Up @@ -76,6 +76,7 @@ class FlagHelperBox extends PaginationBox {
.collect(Collectors.toList()); .collect(Collectors.toList());
private static final int SIZE = FLAGS.size() == Flags.INBUILT_FLAGS.size() ? FLAGS.size() : FLAGS.size() + 1; 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 int PAD_PX_SIZE = 180;
private static final Set<Flag<?>> DANGER_ZONE = ImmutableSet.of(Flags.BUILD, Flags.PASSTHROUGH, Flags.BLOCK_PLACE, Flags.BLOCK_BREAK);


private final World world; private final World world;
private final ProtectedRegion region; private final ProtectedRegion region;
Expand Down Expand Up @@ -200,7 +201,13 @@ private <V> void appendValueChoices(TextComponent.Builder builder, Flag<V> flag,
if (maySet) { if (maySet) {
if (isExplicitSet) { if (isExplicitSet) {
hoverTexts.add(TextComponent.of("Click to unset", TextColor.GOLD)); 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)); hoverTexts.add(TextComponent.of("Click to set", TextColor.GOLD));
} }
} }
Expand All @@ -221,7 +228,7 @@ private <V> void appendValueChoices(TextComponent.Builder builder, Flag<V> flag,
HoverEvent.of(HoverEvent.Action.SHOW_TEXT, hoverBuilder.build())); 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, builder.append(choiceComponent.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND,
makeCommand(flag, isExplicitSet ? "" : choice)))); makeCommand(flag, isExplicitSet ? "" : choice))));
} else { } else {
Expand Down
Expand Up @@ -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("Only set this flag if you are sure you know what you are doing. See ")
.append(TextComponent.of("[this documentation page]", TextColor.AQUA) .append(TextComponent.of("[this documentation page]", TextColor.AQUA)
.clickEvent(ClickEvent.of(ClickEvent.Action.OPEN_URL, .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.")))); .append(TextComponent.of(" for more info."))));
if (!sender.isPlayer()) { 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) { } else if (foundFlag == Flags.PASSTHROUGH) {
sender.print(TextComponent.empty().append(TextComponent.of("WARNING:", TextColor.RED, Sets.newHashSet(TextDecoration.BOLD))) sender.print(TextComponent.empty().append(TextComponent.of("WARNING:", TextColor.RED, Sets.newHashSet(TextDecoration.BOLD)))
Expand All @@ -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("It overrides build checks. If you're unsure what this means, see ")
.append(TextComponent.of("[this documentation page]", TextColor.AQUA) .append(TextComponent.of("[this documentation page]", TextColor.AQUA)
.clickEvent(ClickEvent.of(ClickEvent.Action.OPEN_URL, .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.")))); .append(TextComponent.of(" for more info."))));
if (!sender.isPlayer()) { 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");
} }
} }
} }
Expand Down

0 comments on commit bbed280

Please sign in to comment.