diff --git a/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/mc/MCSlashCommand.java b/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/mc/MCSlashCommand.java index c8411e5..e8844ef 100644 --- a/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/mc/MCSlashCommand.java +++ b/src/main/java/com/hypherionmc/sdlink/core/discord/commands/slash/mc/MCSlashCommand.java @@ -11,6 +11,7 @@ import com.hypherionmc.sdlink.core.managers.RoleManager; import com.hypherionmc.sdlink.core.messaging.Result; import com.hypherionmc.sdlink.core.services.SDLinkPlatform; import com.jagrosh.jdautilities.command.SlashCommandEvent; +import net.dv8tion.jda.api.entities.Member; import net.dv8tion.jda.api.entities.Role; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.build.OptionData; @@ -69,12 +70,12 @@ public class MCSlashCommand extends SDLinkSlashCommand { boolean userRole = role != null && event.getMember().getRoles().stream().anyMatch(r -> r.getIdLong() == role.getIdLong()); if (userRole) { - executeCommand(event, command, args.toString()); + executeCommand(event, command, args.toString(), event.getMember()); } else { event.reply("You need the " + role.getName() + " role to perform this action").setEphemeral(true).queue(); } } else { - executeCommand(event, command, args.toString()); + executeCommand(event, command, args.toString(), event.getMember()); } }); @@ -87,8 +88,8 @@ public class MCSlashCommand extends SDLinkSlashCommand { } } - private void executeCommand(SlashCommandEvent event, LinkedCommandsConfig.Command mcCommand, String args) { - Result result = SDLinkPlatform.minecraftHelper.executeMinecraftCommand(mcCommand.mcCommand, args); + private void executeCommand(SlashCommandEvent event, LinkedCommandsConfig.Command mcCommand, String args, Member member) { + Result result = SDLinkPlatform.minecraftHelper.executeMinecraftCommand(mcCommand.mcCommand, args, member); event.reply(result.getMessage()).setEphemeral(true).queue(); } } diff --git a/src/main/java/com/hypherionmc/sdlink/core/services/helpers/IMinecraftHelper.java b/src/main/java/com/hypherionmc/sdlink/core/services/helpers/IMinecraftHelper.java index d3a711c..c5530bc 100644 --- a/src/main/java/com/hypherionmc/sdlink/core/services/helpers/IMinecraftHelper.java +++ b/src/main/java/com/hypherionmc/sdlink/core/services/helpers/IMinecraftHelper.java @@ -27,7 +27,7 @@ public interface IMinecraftHelper { List getOnlinePlayers(); long getServerUptime(); String getServerVersion(); - Result executeMinecraftCommand(String command, String args); + Result executeMinecraftCommand(String command, String args, Member member); boolean isOnlineMode(); }