From a057853cbd0136a7d537338df2b4a717f83de5ed Mon Sep 17 00:00:00 2001 From: Liam Date: Mon, 1 Jul 2024 21:21:47 +0100 Subject: [PATCH] add feature disabled check --- .../bat/features/messagesnipe/MessageSnipeFeature.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java b/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java index 892f8f4..28cd1f9 100644 --- a/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java +++ b/src/main/java/cc/fascinated/bat/features/messagesnipe/MessageSnipeFeature.java @@ -86,6 +86,9 @@ public class MessageSnipeFeature extends Feature implements EventListener { @Override public void onGuildMessageReceive(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull MessageReceivedEvent event) { if (event.getAuthor().isBot()) return; + if (guild.getFeatureProfile().isFeatureDisabled(this)) { + return; + } List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()); if (messages.size() >= 10) { @@ -97,6 +100,9 @@ public class MessageSnipeFeature extends Feature implements EventListener { @Override public void onGuildMessageDelete(@NonNull BatGuild guild, BatUser user, DiscordMessage message, @NonNull MessageDeleteEvent event) { + if (guild.getFeatureProfile().isFeatureDisabled(this)) { + return; + } List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()); if (messages.size() >= 10) { messages.remove(0); @@ -110,6 +116,9 @@ public class MessageSnipeFeature extends Feature implements EventListener { @Override public void onGuildMessageEdit(@NonNull BatGuild guild, @NonNull BatUser user, @NonNull MessageUpdateEvent event) { + if (guild.getFeatureProfile().isFeatureDisabled(this)) { + return; + } List messages = snipedMessages.getOrDefault(guild, new ArrayList<>()); if (messages.size() >= 10) { messages.remove(0);