diff --git a/src/main/java/com/xujiayao/discord_mc_chat/Main.java b/src/main/java/com/xujiayao/discord_mc_chat/Main.java index db6ca2b7..30ae156a 100644 --- a/src/main/java/com/xujiayao/discord_mc_chat/Main.java +++ b/src/main/java/com/xujiayao/discord_mc_chat/Main.java @@ -106,13 +106,16 @@ public void onInitializeServer() { if (!CONFIG.generic.updateNotificationChannelId.isEmpty()) { UPDATE_NOTIFICATION_CHANNEL = JDA.getTextChannelById(CONFIG.generic.updateNotificationChannelId); if (UPDATE_NOTIFICATION_CHANNEL == null) { + UPDATE_NOTIFICATION_CHANNEL = CHANNEL; throw new NullPointerException("Invalid Update Notification Channel ID"); } // TODO This (including other messages, /reload) should be checked every time before sending! if (!UPDATE_NOTIFICATION_CHANNEL.canTalk()) { - LOGGER.warn("Unable to send messages in the Update Notification Channel; Using the default channel instead."); UPDATE_NOTIFICATION_CHANNEL = CHANNEL; + LOGGER.warn("Unable to send messages in the Update Notification Channel; Using the default channel instead."); } + } else { + UPDATE_NOTIFICATION_CHANNEL = CHANNEL; } String webhookName = "DMCC Webhook" + " (" + JDA.getSelfUser().getApplicationId() + ")"; diff --git a/src/main/java/com/xujiayao/discord_mc_chat/utils/Utils.java b/src/main/java/com/xujiayao/discord_mc_chat/utils/Utils.java index 43f5bdc9..507d4173 100644 --- a/src/main/java/com/xujiayao/discord_mc_chat/utils/Utils.java +++ b/src/main/java/com/xujiayao/discord_mc_chat/utils/Utils.java @@ -292,12 +292,15 @@ public static String reload() { if (!CONFIG.generic.updateNotificationChannelId.isEmpty()) { UPDATE_NOTIFICATION_CHANNEL = JDA.getTextChannelById(CONFIG.generic.updateNotificationChannelId); if (UPDATE_NOTIFICATION_CHANNEL == null) { + UPDATE_NOTIFICATION_CHANNEL = CHANNEL; throw new NullPointerException("Invalid Update Notification Channel ID"); } if (!UPDATE_NOTIFICATION_CHANNEL.canTalk()) { - LOGGER.warn("Unable to send messages in the Update Notification Channel; Using the default channel instead."); UPDATE_NOTIFICATION_CHANNEL = CHANNEL; + LOGGER.warn("Unable to send messages in the Update Notification Channel; Using the default channel instead."); } + } else { + UPDATE_NOTIFICATION_CHANNEL = CHANNEL; } String webhookName = "DMCC Webhook" + " (" + JDA.getSelfUser().getApplicationId() + ")";