mirror of
https://github.com/EssentialsX/Essentials.git
synced 2024-12-22 09:08:01 +01:00
Fix discord permission issues with link module (#5197)
This commit is contained in:
parent
0936fe80bd
commit
ca71d93963
@ -198,7 +198,10 @@ public class DiscordSettings implements IConf {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCommandSnowflakes(String command) {
|
public List<String> getCommandSnowflakes(String command) {
|
||||||
return config.getList("commands." + command + ".allowed-roles", String.class);
|
if (config.isList("commands." + command + ".allowed-roles")) {
|
||||||
|
return config.getList("commands." + command + ".allowed-roles", String.class);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<String> getCommandAdminSnowflakes(String command) {
|
public List<String> getCommandAdminSnowflakes(String command) {
|
||||||
|
@ -56,7 +56,8 @@ public class InteractionControllerImpl extends ListenerAdapter implements Intera
|
|||||||
event.deferReply(command.isEphemeral()).queue(null, failure -> logger.log(Level.SEVERE, "Error while deferring Discord command", failure));
|
event.deferReply(command.isEphemeral()).queue(null, failure -> logger.log(Level.SEVERE, "Error while deferring Discord command", failure));
|
||||||
|
|
||||||
final InteractionEvent interactionEvent = new InteractionEventImpl(event);
|
final InteractionEvent interactionEvent = new InteractionEventImpl(event);
|
||||||
if (!DiscordUtil.hasRoles(event.getMember(), jda.getSettings().getCommandSnowflakes(command.getName()))) {
|
final List<String> commandSnowflakes = jda.getSettings().getCommandSnowflakes(command.getName());
|
||||||
|
if (commandSnowflakes != null && !DiscordUtil.hasRoles(event.getMember(), commandSnowflakes)) {
|
||||||
interactionEvent.reply(tl("noAccessCommand"));
|
interactionEvent.reply(tl("noAccessCommand"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user