Fixed slash-server commands ignoring pre-queue checks (e.g. joinfrom permission)

This commit is contained in:
ajgeiss0702
2023-10-14 16:14:18 -07:00
parent d61ce73cde
commit 7eb1a75a35
@@ -1,6 +1,7 @@
package us.ajg0702.queue.commands.commands.SlashServer;
import com.google.common.collect.ImmutableList;
import us.ajg0702.queue.api.commands.IBaseCommand;
import us.ajg0702.queue.api.commands.ICommandSender;
import us.ajg0702.queue.commands.BaseCommand;
import us.ajg0702.queue.common.QueueMain;
@@ -14,6 +15,10 @@ public class SlashServerCommand extends BaseCommand {
final QueueMain main;
final String server;
final String command;
private IBaseCommand moveCommand;
public SlashServerCommand(QueueMain main, String server) {
this.main = main;
this.server = server;
@@ -51,11 +56,10 @@ public class SlashServerCommand extends BaseCommand {
sender.sendMessage(getMessages().getComponent("errors.player-only"));
return;
}
if(main.getConfig().getBoolean("require-permission") && !sender.hasPermission("ajqueue.queue."+server)) {
sender.sendMessage(getMessages().getComponent("noperm"));
return;
if(moveCommand == null) {
moveCommand = main.getPlatformMethods().getCommands().get(0);
}
main.getQueueManager().addToQueue(main.getPlatformMethods().senderToPlayer(sender), server);
moveCommand.execute(sender, new String[]{server});
}
@Override