mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Fix help command (#2604)
* Always pass session to execute() if the sender is a geyser player * cleanup
This commit is contained in:
parent
eb211884de
commit
1929a5be83
5 changed files with 32 additions and 37 deletions
|
@ -46,26 +46,24 @@ public class GeyserVelocityCommandExecutor extends CommandExecutor implements Si
|
|||
|
||||
@Override
|
||||
public void execute(Invocation invocation) {
|
||||
CommandSender sender = new VelocityCommandSender(invocation.source());
|
||||
GeyserSession session = getGeyserSession(sender);
|
||||
|
||||
if (invocation.arguments().length > 0) {
|
||||
GeyserCommand command = getCommand(invocation.arguments()[0]);
|
||||
if (command != null) {
|
||||
CommandSender sender = new VelocityCommandSender(invocation.source());
|
||||
if (!invocation.source().hasPermission(getCommand(invocation.arguments()[0]).getPermission())) {
|
||||
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.permission_fail", sender.getLocale()));
|
||||
return;
|
||||
}
|
||||
GeyserSession session = null;
|
||||
if (command.isBedrockOnly()) {
|
||||
session = getGeyserSession(sender);
|
||||
if (session == null) {
|
||||
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale()));
|
||||
return;
|
||||
}
|
||||
if (command.isBedrockOnly() && session == null) {
|
||||
sender.sendMessage(ChatColor.RED + LanguageUtils.getPlayerLocaleString("geyser.bootstrap.command.bedrock_only", sender.getLocale()));
|
||||
return;
|
||||
}
|
||||
command.execute(session, sender, invocation.arguments().length > 1 ? Arrays.copyOfRange(invocation.arguments(), 1, invocation.arguments().length) : new String[0]);
|
||||
}
|
||||
} else {
|
||||
getCommand("help").execute(null, new VelocityCommandSender(invocation.source()), new String[0]);
|
||||
getCommand("help").execute(session, sender, new String[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue