feat: option to log connection status messages or not

This commit is contained in:
ChomeNS
2025-05-08 18:47:55 +07:00
parent ca61686a70
commit 4be485df0f
5 changed files with 8 additions and 5 deletions

View File

@@ -176,6 +176,7 @@ public class Configuration {
public boolean useChat = false;
public boolean useSNBTComponents = true;
public boolean coreCommandSpy = true;
public boolean logConnectionStatusMessages = true;
public boolean resolveSRV = true;
public int reconnectDelay = 2000;
public int chatQueueDelay = 125;

View File

@@ -112,7 +112,7 @@ public class DiscordPlugin {
@Override
public void onConnecting () {
if (bot.connectAttempts > 6) return;
if (!bot.options.logConnectionStatusMessages || bot.connectAttempts > 6) return;
else if (bot.connectAttempts == 6) {
sendMessageInstantly(I18nUtilities.get("info.suppressing"), channelId);
@@ -141,7 +141,7 @@ public class DiscordPlugin {
@Override
public void disconnected (final DisconnectedEvent event) {
if (bot.connectAttempts >= 6) return;
if (!bot.options.logConnectionStatusMessages || bot.connectAttempts >= 6) return;
final String reason = ComponentUtilities.stringifyDiscordAnsi(event.getReason());
sendMessageInstantly(

View File

@@ -43,7 +43,7 @@ public class LoggerPlugin implements Listener {
@Override
public void onConnecting () {
if (bot.connectAttempts > 10) return;
if (!bot.options.logConnectionStatusMessages || bot.connectAttempts > 10) return;
else if (bot.connectAttempts == 10) {
log(I18nUtilities.get("info.suppressing"));
@@ -70,7 +70,7 @@ public class LoggerPlugin implements Listener {
@Override
public void disconnected (final DisconnectedEvent event) {
if (bot.connectAttempts >= 10) return;
if (!bot.options.logConnectionStatusMessages || bot.connectAttempts >= 10) return;
final Component message = Component.translatable(
I18nUtilities.get("info.disconnected"),