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

@ -64,10 +64,10 @@ public class GeyserBungeeCommandExecutor extends Command implements TabExecutor
sender.sendMessage(TextComponent.fromLegacyText(ChatColor.RED + message));
return;
}
getCommand(args[0]).execute(new BungeeCommandSender(sender), args);
getCommand(args[0]).execute(new BungeeCommandSender(sender), args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]);
}
} else {
getCommand("help").execute(new BungeeCommandSender(sender), args);
getCommand("help").execute(new BungeeCommandSender(sender), new String[0]);
}
}

View file

@ -59,11 +59,11 @@ public class GeyserSpigotCommandExecutor implements TabExecutor {
sender.sendMessage(ChatColor.RED + message);
return true;
}
getCommand(args[0]).execute(new SpigotCommandSender(sender), args);
getCommand(args[0]).execute(new SpigotCommandSender(sender), args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]);
return true;
}
} else {
getCommand("help").execute(new SpigotCommandSender(sender), args);
getCommand("help").execute(new SpigotCommandSender(sender), new String[0]);
return true;
}
return true;

View file

@ -59,10 +59,10 @@ public class GeyserSpongeCommandExecutor implements CommandCallable {
source.sendMessage(Text.of(ChatColor.RED + LanguageUtils.getLocaleStringLog("geyser.bootstrap.command.permission_fail")));
return CommandResult.success();
}
getCommand(args[0]).execute(new SpongeCommandSender(source), args);
getCommand(args[0]).execute(new SpongeCommandSender(source), args.length > 1 ? Arrays.copyOfRange(args, 1, args.length) : new String[0]);
}
} else {
getCommand("help").execute(new SpongeCommandSender(source), args);
getCommand("help").execute(new SpongeCommandSender(source), new String[0]);
}
return CommandResult.success();
}

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]);
}
}