mirror of https://github.com/GeyserMC/Geyser.git
Don't force perm registration of perms used by commands
feeling kinda icky but idk
This commit is contained in:
parent
2ab03e7415
commit
887509bde7
|
@ -170,7 +170,7 @@ public interface Command {
|
|||
* @param defaultValue the node's default value
|
||||
* @return the builder
|
||||
*/
|
||||
Builder<T> permission(@Nullable String permission, TriState defaultValue);
|
||||
Builder<T> permission(@Nullable String permission, @NonNull TriState defaultValue);
|
||||
|
||||
/**
|
||||
* Sets the aliases.
|
||||
|
|
|
@ -166,7 +166,7 @@ public class CommandRegistry {
|
|||
commands.put(alias, command);
|
||||
}
|
||||
|
||||
if (!command.permission().isBlank()) {
|
||||
if (!command.permission().isBlank() && command.permissionDefault() != null) {
|
||||
permissions.put(command.permission(), command.permissionDefault());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ public class ExtensionCommandBuilder<T extends CommandSource> implements Command
|
|||
private String name;
|
||||
private String description;
|
||||
private String permission;
|
||||
private TriState permissionDefault = TriState.NOT_SET;
|
||||
private TriState permissionDefault;
|
||||
private List<String> aliases;
|
||||
private boolean suggestedOpOnly = false; // deprecated for removal
|
||||
private boolean executableOnConsole = true;
|
||||
|
|
|
@ -68,9 +68,10 @@ public abstract class GeyserCommand implements org.geysermc.geyser.api.command.C
|
|||
private final String permission;
|
||||
|
||||
/**
|
||||
* The default value of the permission node
|
||||
* The default value of the permission node.
|
||||
* A null value indicates that the permission node should not be registered whatsoever.
|
||||
*/
|
||||
@NonNull
|
||||
@Nullable
|
||||
private final TriState permissionDefault;
|
||||
|
||||
/**
|
||||
|
@ -89,7 +90,7 @@ public abstract class GeyserCommand implements org.geysermc.geyser.api.command.C
|
|||
protected List<String> aliases = Collections.emptyList();
|
||||
|
||||
public GeyserCommand(@NonNull String name, @Nullable String description,
|
||||
@Nullable String permission, @NonNull TriState permissionDefault,
|
||||
@Nullable String permission, @Nullable TriState permissionDefault,
|
||||
boolean executableOnConsole, boolean bedrockOnly) {
|
||||
|
||||
if (name == null || name.isBlank()) {
|
||||
|
@ -99,7 +100,7 @@ public abstract class GeyserCommand implements org.geysermc.geyser.api.command.C
|
|||
this.name = name;
|
||||
this.description = description != null ? description : "";
|
||||
this.permission = permission != null ? permission : "";
|
||||
this.permissionDefault = Objects.requireNonNull(permissionDefault, "permissionDefault");
|
||||
this.permissionDefault = permissionDefault;
|
||||
|
||||
if (bedrockOnly && executableOnConsole) {
|
||||
throw new IllegalArgumentException("Command cannot be both bedrockOnly and executableOnConsole");
|
||||
|
@ -131,7 +132,7 @@ public abstract class GeyserCommand implements org.geysermc.geyser.api.command.C
|
|||
return permission;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Nullable
|
||||
public final TriState permissionDefault() {
|
||||
return permissionDefault;
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ public abstract class GeyserExtensionCommand extends GeyserCommand {
|
|||
private final String rootCommand;
|
||||
|
||||
public GeyserExtensionCommand(@NonNull Extension extension, @NonNull String name, @Nullable String description,
|
||||
@Nullable String permission, @NonNull TriState permissionDefault,
|
||||
@Nullable String permission, @Nullable TriState permissionDefault,
|
||||
boolean executableOnConsole, boolean bedrockOnly) {
|
||||
|
||||
super(name, description, permission, permissionDefault, executableOnConsole, bedrockOnly);
|
||||
|
|
Loading…
Reference in New Issue