Only register update checker on platforms that have it (#4787)
Signed-off-by: FlorianMichael <git@florianmichael.de>
This commit is contained in:
1 parent
dcfeda181c
commit
4e83c361bd
4 files changed
+23
-13
No files matched your search
+5
@@ -25,6 +25,11 @@ import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.command.TabExecutor;
|
||||
|
||||
public class BukkitCommandHandler extends ViaCommandHandler implements CommandExecutor, TabExecutor {
|
||||
|
||||
public BukkitCommandHandler() {
|
||||
super(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
return onCommand(new BukkitCommandSender(sender), args);
|
||||
|
||||
@@ -46,8 +46,23 @@ import static com.viaversion.viaversion.api.command.ViaSubCommand.color;
|
||||
public class ViaCommandHandler implements ViaVersionCommand {
|
||||
private final Map<String, ViaSubCommand> commandMap = new HashMap<>();
|
||||
|
||||
@Deprecated
|
||||
public ViaCommandHandler() {
|
||||
registerDefaults();
|
||||
this(true);
|
||||
}
|
||||
|
||||
public ViaCommandHandler(final boolean checkForUpdates) {
|
||||
registerSubCommand(new ListSubCmd());
|
||||
registerSubCommand(new PPSSubCmd());
|
||||
registerSubCommand(new DebugSubCmd());
|
||||
registerSubCommand(new DumpSubCmd());
|
||||
registerSubCommand(new DisplayLeaksSubCmd());
|
||||
registerSubCommand(new AutoTeamSubCmd());
|
||||
registerSubCommand(new ReloadSubCmd());
|
||||
registerSubCommand(new PlayerSubCmd());
|
||||
if (checkForUpdates) {
|
||||
registerSubCommand(new DontBugMeSubCmd());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -190,16 +205,4 @@ public class ViaCommandHandler implements ViaVersionCommand {
|
||||
private boolean hasPermission(ViaCommandSender sender, String permission) {
|
||||
return permission == null || sender.hasPermission("viaversion.admin") || sender.hasPermission(permission);
|
||||
}
|
||||
|
||||
private void registerDefaults() {
|
||||
registerSubCommand(new ListSubCmd());
|
||||
registerSubCommand(new PPSSubCmd());
|
||||
registerSubCommand(new DebugSubCmd());
|
||||
registerSubCommand(new DumpSubCmd());
|
||||
registerSubCommand(new DisplayLeaksSubCmd());
|
||||
registerSubCommand(new DontBugMeSubCmd());
|
||||
registerSubCommand(new AutoTeamSubCmd());
|
||||
registerSubCommand(new ReloadSubCmd());
|
||||
registerSubCommand(new PlayerSubCmd());
|
||||
}
|
||||
}
|
||||
@@ -118,6 +118,7 @@ public class AbstractViaConfig extends Config implements ViaVersionConfig {
|
||||
public List<String> getUnsupportedOptions() {
|
||||
final List<String> unsupportedOptions = new ArrayList<>(BUKKIT_ONLY_OPTIONS);
|
||||
unsupportedOptions.addAll(VELOCITY_ONLY_OPTIONS);
|
||||
unsupportedOptions.add("check-for-updates");
|
||||
return unsupportedOptions;
|
||||
}
|
||||
|
||||
|
||||
+1
@@ -24,6 +24,7 @@ import java.util.List;
|
||||
|
||||
public class VelocityCommandHandler extends ViaCommandHandler implements SimpleCommand {
|
||||
public VelocityCommandHandler() {
|
||||
super(true);
|
||||
registerSubCommand(new ProbeSubCmd());
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user