From 40e7ef784fc83d95a9bcb214949071cf62a7459a Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Thu, 22 Nov 2018 19:29:02 -0500 Subject: [PATCH] Enhance /velocity command. Closes #145 --- .../com/velocitypowered/proxy/command/VelocityCommand.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java b/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java index d5c9f7a85..a6449a5e4 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/command/VelocityCommand.java @@ -92,7 +92,7 @@ public class VelocityCommand implements Command { @Override public boolean hasPermission(CommandSource source, String @NonNull [] args) { if (args.length == 0) { - return true; + return subcommands.values().stream().anyMatch(e -> e.hasPermission(source, args)); } Command command = subcommands.get(args[0].toLowerCase(Locale.US)); if (command == null) { @@ -113,6 +113,11 @@ public class VelocityCommand implements Command { @Override public void execute(CommandSource source, String @NonNull [] args) { + if (args.length != 0) { + source.sendMessage(TextComponent.of("/velocity version", TextColor.RED)); + return; + } + ProxyVersion version = server.getVersion(); TextComponent velocity = TextComponent.builder(version.getName() + " ")