Skip to content

Commit f4cd1c9

Browse files
authored
Discord: Fix custom bot name requiring show-avatar (#6239)
Fixes #5878. Caused by a regression from 384f63b, we were checking for for the legacy options when we should really be checking if `mc-to-discord-name-format` is anything other than the bot name.
1 parent d002c34 commit f4cd1c9

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

EssentialsDiscord/src/main/java/net/essentialsx/discord/DiscordSettings.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ public boolean isShowDisplayName() {
202202
return config.getBoolean("show-displayname", false);
203203
}
204204

205+
protected boolean isCustomBotName() {
206+
if (isShowName() || isShowDisplayName()) {
207+
return true;
208+
}
209+
210+
final String format = getFormatString("mc-to-discord-name-format");
211+
212+
return format != null && !format.isEmpty() && !format.equals("{botname}");
213+
}
214+
205215
public String getAvatarURL() {
206216
return config.getString("avatar-url", "https://crafthead.net/helm/{uuid}");
207217
}

EssentialsDiscord/src/main/java/net/essentialsx/discord/JDADiscordService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public void updatePresence() {
367367
}
368368

369369
public void updateTypesRelay() {
370-
if (!getSettings().isShowAvatar() && !getSettings().isShowName() && !getSettings().isShowDisplayName()) {
370+
if (!getSettings().isShowAvatar() && !getSettings().isCustomBotName()) {
371371
for (WrappedWebhookClient webhook : channelIdToWebhook.values()) {
372372
webhook.close();
373373
}

0 commit comments

Comments
 (0)