From a8944309c8e9cda6839912aa34c9ea6370d68b86 Mon Sep 17 00:00:00 2001 From: Vankka Date: Thu, 14 Apr 2022 10:55:01 +0300 Subject: [PATCH] Some minor config comment improvements --- .../{DiscordIgnores.java => DiscordIgnoresConfig.java} | 8 ++++---- .../main/channels/DiscordToMinecraftChatConfig.java | 4 ++-- .../common/config/main/channels/MirroringConfig.java | 6 +++--- .../discord/DiscordChatMessageModule.java | 4 ++-- .../discord/DiscordMessageMirroringModule.java | 4 ++-- 5 files changed, 13 insertions(+), 13 deletions(-) rename common/src/main/java/com/discordsrv/common/config/main/{DiscordIgnores.java => DiscordIgnoresConfig.java} (90%) diff --git a/common/src/main/java/com/discordsrv/common/config/main/DiscordIgnores.java b/common/src/main/java/com/discordsrv/common/config/main/DiscordIgnoresConfig.java similarity index 90% rename from common/src/main/java/com/discordsrv/common/config/main/DiscordIgnores.java rename to common/src/main/java/com/discordsrv/common/config/main/DiscordIgnoresConfig.java index 0ff847ed..82bcdf52 100644 --- a/common/src/main/java/com/discordsrv/common/config/main/DiscordIgnores.java +++ b/common/src/main/java/com/discordsrv/common/config/main/DiscordIgnoresConfig.java @@ -28,7 +28,7 @@ import java.util.List; import java.util.Optional; @ConfigSerializable -public class DiscordIgnores { +public class DiscordIgnoresConfig { @Comment("User, bot and webhook ids to ignore") public IDs usersAndWebhookIds = new IDs(); @@ -39,7 +39,7 @@ public class DiscordIgnores { @Comment("If bots (webhooks not included) should be ignored") public boolean bots = false; - @Comment("If webhooks should be ignored") + @Comment("If webhooks should be ignored (webhook messages sent by this DiscordSRV instance will always be ignored)") public boolean webhooks = true; @ConfigSerializable @@ -58,12 +58,12 @@ public class DiscordIgnores { return true; } - DiscordIgnores.IDs users = usersAndWebhookIds; + DiscordIgnoresConfig.IDs users = usersAndWebhookIds; if (users != null && users.ids.contains(author.getId()) != users.whitelist) { return true; } - DiscordIgnores.IDs roles = roleIds; + DiscordIgnoresConfig.IDs roles = roleIds; return roles != null && Optional.ofNullable(member) .map(m -> m.getRoles().stream().anyMatch(role -> roles.ids.contains(role.getId()))) .map(hasRole -> hasRole != roles.whitelist) diff --git a/common/src/main/java/com/discordsrv/common/config/main/channels/DiscordToMinecraftChatConfig.java b/common/src/main/java/com/discordsrv/common/config/main/channels/DiscordToMinecraftChatConfig.java index 3b7b4d65..18ad7da5 100644 --- a/common/src/main/java/com/discordsrv/common/config/main/channels/DiscordToMinecraftChatConfig.java +++ b/common/src/main/java/com/discordsrv/common/config/main/channels/DiscordToMinecraftChatConfig.java @@ -19,7 +19,7 @@ package com.discordsrv.common.config.main.channels; import com.discordsrv.common.config.annotation.Untranslated; -import com.discordsrv.common.config.main.DiscordIgnores; +import com.discordsrv.common.config.main.DiscordIgnoresConfig; import org.spongepowered.configurate.objectmapping.ConfigSerializable; import org.spongepowered.configurate.objectmapping.meta.Comment; @@ -51,7 +51,7 @@ public class DiscordToMinecraftChatConfig { public Map contentRegexFilters = new LinkedHashMap<>(); @Comment("Users, bots and webhooks to ignore") - public DiscordIgnores ignores = new DiscordIgnores(); + public DiscordIgnoresConfig ignores = new DiscordIgnoresConfig(); @Comment("The representations of Discord mentions in-game") public Mentions mentions = new Mentions(); diff --git a/common/src/main/java/com/discordsrv/common/config/main/channels/MirroringConfig.java b/common/src/main/java/com/discordsrv/common/config/main/channels/MirroringConfig.java index b86a454f..664b5e81 100644 --- a/common/src/main/java/com/discordsrv/common/config/main/channels/MirroringConfig.java +++ b/common/src/main/java/com/discordsrv/common/config/main/channels/MirroringConfig.java @@ -18,7 +18,7 @@ package com.discordsrv.common.config.main.channels; -import com.discordsrv.common.config.main.DiscordIgnores; +import com.discordsrv.common.config.main.DiscordIgnoresConfig; import org.spongepowered.configurate.objectmapping.ConfigSerializable; import org.spongepowered.configurate.objectmapping.meta.Comment; @@ -28,10 +28,10 @@ public class MirroringConfig { public boolean enabled = true; @Comment("Users, bots and webhooks to ignore when mirroring") - public DiscordIgnores ignores = new DiscordIgnores(); + public DiscordIgnoresConfig ignores = new DiscordIgnoresConfig(); @Comment("The format of the username of mirrored messages\n" + "It's recommended to include some special character if in-game messages use webhooks,\n" - + "in order to prevent Discord users and in-game players being grouped together") + + "in order to prevent Discord users and in-game players with the same name being grouped together") public String usernameFormat = "%user_effective_name% \uD83D\uDD03"; } diff --git a/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java b/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java index 1cefbc9c..c514cc99 100644 --- a/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java +++ b/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordChatMessageModule.java @@ -32,7 +32,7 @@ import com.discordsrv.api.placeholder.util.Placeholders; import com.discordsrv.common.DiscordSRV; import com.discordsrv.common.component.renderer.DiscordSRVMinecraftRenderer; import com.discordsrv.common.component.util.ComponentUtil; -import com.discordsrv.common.config.main.DiscordIgnores; +import com.discordsrv.common.config.main.DiscordIgnoresConfig; import com.discordsrv.common.config.main.channels.DiscordToMinecraftChatConfig; import com.discordsrv.common.config.main.channels.base.BaseChannelConfig; import com.discordsrv.common.function.OrDefault; @@ -87,7 +87,7 @@ public class DiscordChatMessageModule extends AbstractModule { DiscordGuildMember member = discordMessage.getMember().orElse(null); boolean webhookMessage = discordMessage.isWebhookMessage(); - DiscordIgnores ignores = chatConfig.get(cfg -> cfg.ignores); + DiscordIgnoresConfig ignores = chatConfig.get(cfg -> cfg.ignores); if (ignores != null && ignores.shouldBeIgnored(webhookMessage, author, member)) { // TODO: response for humans return; diff --git a/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordMessageMirroringModule.java b/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordMessageMirroringModule.java index 0157a1fc..5e11c169 100644 --- a/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordMessageMirroringModule.java +++ b/common/src/main/java/com/discordsrv/common/messageforwarding/discord/DiscordMessageMirroringModule.java @@ -32,7 +32,7 @@ import com.discordsrv.api.discord.events.message.DiscordMessageUpdateEvent; import com.discordsrv.api.event.bus.Subscribe; import com.discordsrv.api.event.events.message.receive.discord.DiscordChatMessageProcessingEvent; import com.discordsrv.common.DiscordSRV; -import com.discordsrv.common.config.main.DiscordIgnores; +import com.discordsrv.common.config.main.DiscordIgnoresConfig; import com.discordsrv.common.config.main.channels.MirroringConfig; import com.discordsrv.common.config.main.channels.base.BaseChannelConfig; import com.discordsrv.common.config.main.channels.base.IChannelConfig; @@ -83,7 +83,7 @@ public class DiscordMessageMirroringModule extends AbstractModule { continue; } - DiscordIgnores ignores = config.get(cfg -> cfg.ignores); + DiscordIgnoresConfig ignores = config.get(cfg -> cfg.ignores); if (ignores != null && ignores.shouldBeIgnored(message.isWebhookMessage(), message.getAuthor(), message.getMember().orElse(null))) { continue; }