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

@@ -1 +1 @@
3169
3173

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"),

View File

@@ -147,6 +147,7 @@ bots:
# useChat - when the bot tellraws it will chat instead of using the core to run tellraw
# useSNBTComponents - if the server is >=1.21.5, it's pretty likely that you can enable this since 1.21.5 supports SNBT components
# coreCommandSpy - set to true if server supports enabling player's commandspy through command block, defaults to true
# logConnectionStatusMessages - logs connecting and disconnected messages to console (and the log file) and discord if set to true, defaults to true
# resolveSRV - whether to resolve SRV records on the server. the notchian minecraft doesn't resolve them
# essentialsMessages - the messages in essentials that the bot uses for self care (no example is intentional)
# coreRateLimit - will ignore commands if reached the ratelimit
@@ -167,6 +168,7 @@ bots:
# useChat: false
# useSNBTComponents: true
# coreCommandSpy: true
# logConnectionStatusMessages: true
# resolveSRV: true
# reconnectDelay: 2000
# chatQueueDelay: 125