make reconnect delay and chat queue delay in bot options instead of global

This commit is contained in:
Chayapak 2023-06-05 14:10:55 +07:00
parent ad8fa2ba03
commit 00b2e5d4a9
4 changed files with 6 additions and 12 deletions

View file

@ -75,7 +75,6 @@ public class Bot {
this.port = botOption.port; this.port = botOption.port;
this.options = botOption; this.options = botOption;
if (options.reconnectDelay == -1) options.reconnectDelay = config.reconnectDelay;
this.bots = bots; this.bots = bots;

View file

@ -14,10 +14,6 @@ public class Configuration {
@Getter public Map<String, String> consolePrefixes; @Getter public Map<String, String> consolePrefixes;
@Getter public int reconnectDelay = 2000;
@Getter public int chatQueueDelay = 125;
@Getter public Map<String, String> keys; @Getter public Map<String, String> keys;
@Getter public String weatherApiKey; @Getter public String weatherApiKey;
@ -114,7 +110,8 @@ public class Configuration {
@Getter @Setter public boolean useCore = true; @Getter @Setter public boolean useCore = true;
@Getter @Setter public boolean useChat = false; @Getter @Setter public boolean useChat = false;
@Getter public boolean hasEssentials = true; @Getter public boolean hasEssentials = true;
@Getter public int reconnectDelay = -1; @Getter public int reconnectDelay = 2000;
@Getter public boolean removeNamespaces = false; @Getter public boolean removeNamespaces = false;
@Getter public int chatQueueDelay = 125;
} }
} }

View file

@ -45,7 +45,7 @@ public class ChatPlugin extends Bot.Listener {
public ChatPlugin (Bot bot) { public ChatPlugin (Bot bot) {
this.bot = bot; this.bot = bot;
queueDelay = bot.config().chatQueueDelay(); queueDelay = bot.options().chatQueueDelay();
this.commandSpyParser = new CommandSpyParser(bot); this.commandSpyParser = new CommandSpyParser(bot);

View file

@ -11,10 +11,6 @@ consolePrefixes:
normalCommandsPrefix: '.' normalCommandsPrefix: '.'
consoleServerPrefix: '/' consoleServerPrefix: '/'
reconnectDelay: 2000
chatQueueDelay: 125
discord: discord:
enabled: false enabled: false
prefix: 'default!' 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 # 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 # 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 # 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 # removeNamespaces - when the bot sends a command it will remove like `minecraft:` for example if set to true
- host: 'localhost' - host: 'localhost'
@ -107,7 +102,10 @@ bots:
hasEssentials: false hasEssentials: false
reconnectDelay: 2000 reconnectDelay: 2000
removeNamespaces: false removeNamespaces: false
chatQueueDelay: 125
# or without the optional ones: # or without the optional ones:
# - host: 'localhost' # - host: 'localhost'
# port: 25565 # port: 25565
# serverName: 'Localhost' # serverName: 'Localhost'
# reconnectDelay: 2000
# chatQueueDelay: 125