add reconnect delay to each bot option (optional)
This commit is contained in:
parent
a9b40c0ceb
commit
a5359b705a
4 changed files with 22 additions and 18 deletions
|
@ -4,12 +4,11 @@
|
|||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="make trusted broadcast log in console">
|
||||
<list default="true" id="50f184fa-7bed-4956-baf5-7586ff26ea08" name="Changes" comment="add connecting message">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/Bot.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/DiscordPlugin.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/LoggerPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/LoggerPlugin.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/plugins/MusicPlayerPlugin.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/land/chipmunk/chayapak/chomens_bot/Configuration.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/main/resources/default-config.yml" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/resources/default-config.yml" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
@ -101,13 +100,6 @@
|
|||
<option name="presentableId" value="Default" />
|
||||
<updated>1680245437032</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00072" summary="i forgor to remove the code i copied from my chipmunkbot fork">
|
||||
<created>1681692239505</created>
|
||||
<option name="number" value="00072" />
|
||||
<option name="presentableId" value="LOCAL-00072" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1681692239506</updated>
|
||||
</task>
|
||||
<task id="LOCAL-00073" summary="probably fix greplog but more mess,....">
|
||||
<created>1681723369155</created>
|
||||
<option name="number" value="00073" />
|
||||
|
@ -444,7 +436,14 @@
|
|||
<option name="project" value="LOCAL" />
|
||||
<updated>1682401966540</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="121" />
|
||||
<task id="LOCAL-00121" summary="add connecting message">
|
||||
<created>1682403103168</created>
|
||||
<option name="number" value="00121" />
|
||||
<option name="presentableId" value="LOCAL-00121" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1682403103168</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="122" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="Vcs.Log.Tabs.Properties">
|
||||
|
@ -459,7 +458,6 @@
|
|||
</option>
|
||||
</component>
|
||||
<component name="VcsManagerConfiguration">
|
||||
<MESSAGE value="improve reconnect i guess" />
|
||||
<MESSAGE value="make better console logging like the old js chomens bot" />
|
||||
<MESSAGE value="fart !!!!" />
|
||||
<MESSAGE value="sex" />
|
||||
|
@ -484,7 +482,8 @@
|
|||
<MESSAGE value="i forgor 1 thing lmfao" />
|
||||
<MESSAGE value="gex" />
|
||||
<MESSAGE value="make trusted broadcast log in console" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="make trusted broadcast log in console" />
|
||||
<MESSAGE value="add connecting message" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="add connecting message" />
|
||||
</component>
|
||||
<component name="XSLT-Support.FileAssociations.UIState">
|
||||
<expand />
|
||||
|
|
|
@ -69,6 +69,7 @@ public class Bot {
|
|||
this.port = botOption.port;
|
||||
|
||||
this.options = botOption;
|
||||
if (options.reconnectDelay == -1) options.reconnectDelay = config.reconnectDelay;
|
||||
|
||||
this.allBots = allBots;
|
||||
|
||||
|
@ -172,7 +173,7 @@ public class Bot {
|
|||
public void disconnected(DisconnectedEvent disconnectedEvent) {
|
||||
loggedIn = false;
|
||||
|
||||
int reconnectDelay = config.reconnectDelay();
|
||||
int reconnectDelay = options.reconnectDelay();
|
||||
|
||||
final String stringMessage = ComponentUtilities.stringify(disconnectedEvent.getReason());
|
||||
|
||||
|
|
|
@ -14,7 +14,7 @@ public class Configuration {
|
|||
|
||||
@Getter public Map<String, String> consolePrefixes;
|
||||
|
||||
@Getter public int reconnectDelay = 7000;
|
||||
@Getter public int reconnectDelay = 2000;
|
||||
|
||||
@Getter public Map<String, String> keys;
|
||||
|
||||
|
@ -83,5 +83,6 @@ 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -61,14 +61,16 @@ selfCare:
|
|||
prefix: true
|
||||
username: true # do NOT set this to false unless you know what you are doing
|
||||
bots:
|
||||
# username, kaboom, useCore, useChat and hasEssentials are optional.
|
||||
# username, kaboom, useCore, useChat, hasEssentials and reconnectDelay are optional.
|
||||
|
||||
# more info:
|
||||
# for username if it doesn't exist it will default to random username
|
||||
# for kaboom it will just default to `false`
|
||||
# for serverName name it whatever you like, it will be used as server name in trusted broadcast
|
||||
# for serverName name it whatever you like, it will be used as server name in trusted broadcast and in console
|
||||
# for useCore it just sends the command using chat instead of using core. recommended to enable useChat too when this is enabled
|
||||
# for useChat when the bot sends output (tellraw) it will chat instead of using the core to run tellraw
|
||||
# for hasEssentials it is self-explanatory. if the server has essentials plugin just set it to true
|
||||
# for reconnectDelay if not specified it will just default to the global reconnectDelay
|
||||
|
||||
- host: 'localhost'
|
||||
port: 25565
|
||||
|
@ -78,3 +80,4 @@ bots:
|
|||
useCore: true
|
||||
useChat: false
|
||||
hasEssentials: false
|
||||
reconnectDelay: 2000
|
||||
|
|
Loading…
Reference in a new issue