Don't allow setting build + passthrough in the flag helper.

It masks the warning message and too many people mess this up.
This commit is contained in:
wizjany 2019-06-22 14:15:21 -04:00
parent 96b61743b9
commit 6d25513739

View File

@ -200,7 +200,7 @@ private <V> void appendValueChoices(TextComponent.Builder builder, Flag<V> flag,
if (maySet) {
if (isExplicitSet) {
hoverTexts.add(TextComponent.of("Click to unset", TextColor.GOLD));
} else {
} else if (flag != Flags.BUILD && flag != Flags.PASSTHROUGH) {
hoverTexts.add(TextComponent.of("Click to set", TextColor.GOLD));
}
}
@ -221,7 +221,7 @@ private <V> void appendValueChoices(TextComponent.Builder builder, Flag<V> flag,
HoverEvent.of(HoverEvent.Action.SHOW_TEXT, hoverBuilder.build()));
}
if (maySet) {
if (maySet && (isExplicitSet || flag != Flags.BUILD && flag != Flags.PASSTHROUGH)) {
builder.append(choiceComponent.clickEvent(ClickEvent.of(ClickEvent.Action.RUN_COMMAND,
makeCommand(flag, isExplicitSet ? "" : choice))));
} else {