From 7eb1a75a35f704fd781222cb0119cbbf1f865635 Mon Sep 17 00:00:00 2001 From: ajgeiss0702 Date: Sat, 14 Oct 2023 16:14:18 -0700 Subject: [PATCH] Fixed slash-server commands ignoring pre-queue checks (e.g. joinfrom permission) --- .../commands/SlashServer/SlashServerCommand.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java b/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java index eaf7952..551ce4e 100644 --- a/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java +++ b/common/src/main/java/us/ajg0702/queue/commands/commands/SlashServer/SlashServerCommand.java @@ -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