Define default permissions of builtin commands

This commit is contained in:
Konicai 2023-09-01 21:51:46 -04:00
parent 7ee26fb2bd
commit 94d3f6229c
No known key found for this signature in database
GPG Key ID: 710D09287708C823
14 changed files with 28 additions and 15 deletions

View File

@ -109,8 +109,8 @@ public abstract class GeyserCommand implements org.geysermc.geyser.api.command.C
this.bedrockOnly = bedrockOnly;
}
public GeyserCommand(@NonNull String name, @NonNull String description, @Nullable String permission) {
this(name, description, permission, TriState.NOT_SET, true, false);
public GeyserCommand(@NonNull String name, @NonNull String description, @Nullable String permission, @NonNull TriState permissionDefault) {
this(name, description, permission, permissionDefault, true, false);
}
@NonNull

View File

@ -27,6 +27,7 @@ package org.geysermc.geyser.command.defaults;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.text.ChatColor;
@ -35,7 +36,7 @@ import org.geysermc.geyser.text.MinecraftLocale;
public class AdvancedTooltipsCommand extends GeyserCommand {
public AdvancedTooltipsCommand(String name, String description, String permission) {
super(name, description, permission, false, true);
super(name, description, permission, TriState.TRUE, false, true);
}
@Override

View File

@ -27,13 +27,14 @@ package org.geysermc.geyser.command.defaults;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
public class AdvancementsCommand extends GeyserCommand {
public AdvancementsCommand(String name, String description, String permission) {
super(name, description, permission, false, true);
super(name, description, permission, TriState.TRUE, false, true);
}
@Override

View File

@ -32,6 +32,7 @@ import cloud.commandframework.arguments.standard.StringArgument;
import cloud.commandframework.context.CommandContext;
import com.fasterxml.jackson.databind.JsonNode;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.util.LoopbackUtil;
@ -47,7 +48,7 @@ public class ConnectionTestCommand extends GeyserCommand {
private final GeyserImpl geyser;
public ConnectionTestCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission);
super(name, description, permission, TriState.NOT_SET);
this.geyser = geyser;
}

View File

@ -34,6 +34,7 @@ import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.dump.DumpInfo;
@ -56,7 +57,7 @@ public class DumpCommand extends GeyserCommand {
private static final String DUMP_URL = "https://dump.geysermc.org/";
public DumpCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission);
super(name, description, permission, TriState.NOT_SET);
this.geyser = geyser;
}

View File

@ -30,6 +30,7 @@ import cloud.commandframework.CommandManager;
import cloud.commandframework.context.CommandContext;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.extension.Extension;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.text.ChatColor;
@ -42,7 +43,7 @@ public class ExtensionsCommand extends GeyserCommand {
private final GeyserImpl geyser;
public ExtensionsCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission);
super(name, description, permission, TriState.TRUE);
this.geyser = geyser;
}

View File

@ -29,6 +29,7 @@ import cloud.commandframework.CommandManager;
import cloud.commandframework.context.CommandContext;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.command.Command;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.text.ChatColor;
@ -45,7 +46,7 @@ public class HelpCommand extends GeyserCommand {
public HelpCommand(GeyserImpl geyser, String name, String description, String permission,
String baseCommand, Map<String, Command> commands) {
super(name, description, permission);
super(name, description, permission, TriState.TRUE);
this.baseCommand = baseCommand;
this.commands = commands.values();

View File

@ -28,6 +28,7 @@ package org.geysermc.geyser.command.defaults;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.session.GeyserSession;
@ -40,7 +41,7 @@ public class ListCommand extends GeyserCommand {
private final GeyserImpl geyser;
public ListCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission);
super(name, description, permission, TriState.NOT_SET);
this.geyser = geyser;
}

View File

@ -28,6 +28,7 @@ package org.geysermc.geyser.command.defaults;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.session.GeyserSession;
@ -35,7 +36,7 @@ import org.geysermc.geyser.session.GeyserSession;
public class OffhandCommand extends GeyserCommand {
public OffhandCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission, false, true);
super(name, description, permission, TriState.TRUE, false, true);
}
@Override

View File

@ -28,6 +28,7 @@ package org.geysermc.geyser.command.defaults;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.text.GeyserLocale;
@ -37,7 +38,7 @@ public class ReloadCommand extends GeyserCommand {
private final GeyserImpl geyser;
public ReloadCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission);
super(name, description, permission, TriState.NOT_SET);
this.geyser = geyser;
}

View File

@ -28,6 +28,7 @@ package org.geysermc.geyser.command.defaults;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.util.SettingsUtils;
@ -35,7 +36,7 @@ import org.geysermc.geyser.util.SettingsUtils;
public class SettingsCommand extends GeyserCommand {
public SettingsCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission, false, true);
super(name, description, permission, TriState.TRUE, false, true);
}
@Override

View File

@ -30,13 +30,14 @@ import cloud.commandframework.CommandManager;
import com.github.steveice10.mc.protocol.data.game.ClientCommand;
import com.github.steveice10.mc.protocol.packet.ingame.serverbound.ServerboundClientCommandPacket;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
public class StatisticsCommand extends GeyserCommand {
public StatisticsCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission, false, true);
super(name, description, permission, TriState.TRUE, false, true);
}
@Override

View File

@ -28,6 +28,7 @@ package org.geysermc.geyser.command.defaults;
import cloud.commandframework.Command;
import cloud.commandframework.CommandManager;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
@ -38,7 +39,7 @@ public class StopCommand extends GeyserCommand {
private final GeyserImpl geyser;
public StopCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission);
super(name, description, permission, TriState.NOT_SET);
this.geyser = geyser;
this.aliases = Collections.singletonList("shutdown");

View File

@ -32,6 +32,7 @@ import org.cloudburstmc.protocol.bedrock.codec.BedrockCodec;
import org.geysermc.geyser.Constants;
import org.geysermc.geyser.api.util.PlatformType;
import org.geysermc.geyser.GeyserImpl;
import org.geysermc.geyser.api.util.TriState;
import org.geysermc.geyser.command.GeyserCommand;
import org.geysermc.geyser.command.GeyserCommandSource;
import org.geysermc.geyser.network.GameProtocol;
@ -49,7 +50,7 @@ public class VersionCommand extends GeyserCommand {
private final GeyserImpl geyser;
public VersionCommand(GeyserImpl geyser, String name, String description, String permission) {
super(name, description, permission);
super(name, description, permission, TriState.NOT_SET);
this.geyser = geyser;
}