From 107ec43149e1cf7e8a45811b4ac8ae81c172fb53 Mon Sep 17 00:00:00 2001 From: Liam Date: Fri, 28 Jun 2024 19:11:37 +0100 Subject: [PATCH] actually fix it --- .../java/cc/fascinated/bat/service/CommandService.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/cc/fascinated/bat/service/CommandService.java b/src/main/java/cc/fascinated/bat/service/CommandService.java index d01240f..ccacd5b 100644 --- a/src/main/java/cc/fascinated/bat/service/CommandService.java +++ b/src/main/java/cc/fascinated/bat/service/CommandService.java @@ -149,6 +149,7 @@ public class CommandService extends ListenerAdapter { try { BatCommandExecutor executor = null; + CommandInfo commandInfo = command.getCommandInfo(); List requiredPermissions = new ArrayList<>(); boolean isSubCommand = false; @@ -164,6 +165,7 @@ public class CommandService extends ListenerAdapter { requiredPermissions.addAll(Arrays.asList(subCommand.getValue().getCommandInfo().requiredPermissions())); requiredPermissions.addAll(Arrays.asList(command.getCommandInfo().requiredPermissions())); // not sure if we'd want this, but it's here for now isSubCommand = true; + commandInfo = subCommand.getValue().getCommandInfo(); break; } } @@ -199,7 +201,11 @@ public class CommandService extends ListenerAdapter { } } - if (isSubCommand && command.getCommandInfo().guildOnly() && !ranInsideGuild) { + System.out.println("isSubCommand = " + isSubCommand); + System.out.println("command.getCommandInfo().guildOnly() = " + command.getCommandInfo().guildOnly()); + System.out.println("ranInsideGuild = " + ranInsideGuild); + + if (isSubCommand && commandInfo.guildOnly() && !ranInsideGuild) { event.replyEmbeds(EmbedUtils.errorEmbed() .setDescription("This command can only be executed in a guild") .build()).setEphemeral(true).queue();