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.options = botOption;
if (options.reconnectDelay == -1) options.reconnectDelay = config.reconnectDelay;
this.bots = bots;

View file

@ -14,10 +14,6 @@ public class Configuration {
@Getter public Map<String, String> consolePrefixes;
@Getter public int reconnectDelay = 2000;
@Getter public int chatQueueDelay = 125;
@Getter public Map<String, String> 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;
}
}

View file

@ -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);

View file

@ -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