From 00b2e5d4a91d04c84abc753f51391bfff50f68d5 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Mon, 5 Jun 2023 14:10:55 +0700 Subject: [PATCH] make reconnect delay and chat queue delay in bot options instead of global --- src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java | 1 - .../land/chipmunk/chayapak/chomens_bot/Configuration.java | 7 ++----- .../chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java | 2 +- src/main/resources/default-config.yml | 8 +++----- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java index 6f96eb8c..dc2106c9 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java @@ -75,7 +75,6 @@ public class Bot { this.port = botOption.port; this.options = botOption; - if (options.reconnectDelay == -1) options.reconnectDelay = config.reconnectDelay; this.bots = bots; diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java index 1f4903cf..fdb1f838 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java @@ -14,10 +14,6 @@ public class Configuration { @Getter public Map consolePrefixes; - @Getter public int reconnectDelay = 2000; - - @Getter public int chatQueueDelay = 125; - @Getter public Map keys; @Getter public String weatherApiKey; @@ -114,7 +110,8 @@ public class Configuration { @Getter @Setter public boolean useCore = true; @Getter @Setter public boolean useChat = false; @Getter public boolean hasEssentials = true; - @Getter public int reconnectDelay = -1; + @Getter public int reconnectDelay = 2000; @Getter public boolean removeNamespaces = false; + @Getter public int chatQueueDelay = 125; } } diff --git a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java index 20d22604..161298ee 100644 --- a/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java +++ b/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/ChatPlugin.java @@ -45,7 +45,7 @@ public class ChatPlugin extends Bot.Listener { public ChatPlugin (Bot bot) { this.bot = bot; - queueDelay = bot.config().chatQueueDelay(); + queueDelay = bot.options().chatQueueDelay(); this.commandSpyParser = new CommandSpyParser(bot); diff --git a/src/main/resources/default-config.yml b/src/main/resources/default-config.yml index b2917690..aaf31768 100644 --- a/src/main/resources/default-config.yml +++ b/src/main/resources/default-config.yml @@ -11,10 +11,6 @@ consolePrefixes: normalCommandsPrefix: '.' consoleServerPrefix: '/' -reconnectDelay: 2000 - -chatQueueDelay: 125 - discord: enabled: false prefix: 'default!' @@ -94,7 +90,6 @@ bots: # useCore - if enabled it just sends the command using chat instead of using core. recommended to enable useChat too when this is enabled # useChat - when the bot tellraws it will chat instead of using the core to run tellraw # hasEssentials - if the server has essentials plugin just set it to true!! ! !!31 - # reconnectDelay - if not specified it will just default to the global reconnectDelay # removeNamespaces - when the bot sends a command it will remove like `minecraft:` for example if set to true - host: 'localhost' @@ -107,7 +102,10 @@ bots: hasEssentials: false reconnectDelay: 2000 removeNamespaces: false + chatQueueDelay: 125 # or without the optional ones: # - host: 'localhost' # port: 25565 # serverName: 'Localhost' + # reconnectDelay: 2000 + # chatQueueDelay: 125