Remove 'geyser' from parameters when executing a command under Spigot, Bungeecord, Sponge, Velocity (#1266)

* Remove 'geyser' from parameters when executing a command under Spigot, Bungeecode, Sponge, Velocity

Fixes https://github.com/bundabrg/GeyserReversion/issues/8

* Fix case when there are no sub commands

Co-authored-by: bundabrg <bundabrg@grieve.com.au>
This commit is contained in:
bundabrg 2020-09-29 11:49:46 +08:00 committed by GitHub
parent 3650321576
commit 650c02ef66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 8 deletions

View file

@ -37,6 +37,8 @@ import org.geysermc.connector.GeyserConnector;
import org.geysermc.connector.command.GeyserCommand;
import org.geysermc.connector.utils.LanguageUtils;
import java.util.Arrays;
@AllArgsConstructor
public class GeyserVelocityCommandExecutor implements Command {
@ -51,10 +53,10 @@ public class GeyserVelocityCommandExecutor implements Command {
source.sendMessage(TextComponent.of(ChatColor.RED + LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.permission_fail")));
return;
}
getCommand(args[0]).execute(new VelocityCommandSender(source), args);
getCommand(args[0]).execute(new VelocityCommandSender(source), args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]);
}
} else {
getCommand("help").execute(new VelocityCommandSender(source), args);
getCommand("help").execute(new VelocityCommandSender(source), new String[0]);
}
}