Allow setting passthrough on global via /rg flags.

Closes #1584.
This commit is contained in:
wizjany 2020-06-11 14:57:22 -04:00
parent 6c5380ba0b
commit f4a3e8a936
2 changed files with 13 additions and 1 deletions

View File

@ -199,7 +199,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 if (DANGER_ZONE.contains(flag)) {
} else if (DANGER_ZONE.contains(flag) && !(ProtectedRegion.GLOBAL_REGION.equals(region.getId()) && flag == Flags.PASSTHROUGH)) {
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.")

View File

@ -21,6 +21,8 @@
import static com.google.common.base.Preconditions.checkNotNull;
import com.google.common.annotations.Beta;
/**
* Stores an Number.
*/
@ -37,10 +39,20 @@ protected NumberFlag(String name) {
super(name);
}
/**
* Not recommended for public use. Will likely be moved when migrating to piston for commands.
* @param values suggested values
*/
@Beta
public void setSuggestedValues(Number[] values) {
this.suggestions = checkNotNull(values);
}
/**
* Not recommended for public use. Will likely be moved when migrating to piston for commands.
* @return suggested values
*/
@Beta
public Number[] getSuggestedValues() {
return suggestions;
}