mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-01-23 07:51:24 +01:00
Add new option: reconnect-fail-message-count
This commit is contained in:
parent
8a5a0988e1
commit
11e065b4f3
@ -154,6 +154,7 @@ public final class PurpleBot {
|
||||
String joinNoticeMessage;
|
||||
String version;
|
||||
String finger;
|
||||
private int reconnectCount;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -201,6 +202,7 @@ public final class PurpleBot {
|
||||
this.enableMessageFiltering = new CaseInsensitiveMap<>();
|
||||
this.plugin = plugin;
|
||||
this.file = file;
|
||||
this.reconnectCount = 0;
|
||||
whoisSenders = new ArrayList<>();
|
||||
config = new YamlConfiguration();
|
||||
loadConfig();
|
||||
@ -248,7 +250,7 @@ public final class PurpleBot {
|
||||
socketFactory.disableDiffieHellman();
|
||||
if (trustAllCerts) {
|
||||
socketFactory.trustAllCertificates();
|
||||
}
|
||||
}
|
||||
configBuilder.setSocketFactory(socketFactory);
|
||||
}
|
||||
if (charSet.isEmpty()) {
|
||||
@ -437,9 +439,13 @@ public final class PurpleBot {
|
||||
plugin.logInfo(connectMessage);
|
||||
}
|
||||
bot.startBot();
|
||||
reconnectCount = 0;
|
||||
} catch (IOException | IrcException ex) {
|
||||
plugin.logError("Problem connecting to " + botServer
|
||||
+ " [Nick: " + botNick + "] [Error: " + ex.getMessage() + "]");
|
||||
if (reconnectCount <= plugin.reconnectSuppression) {
|
||||
plugin.logError("Problem connecting to " + botServer
|
||||
+ " [Nick: " + botNick + "] [Error: " + ex.getMessage() + "]");
|
||||
}
|
||||
reconnectCount++;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -188,6 +188,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
private YamlConfiguration heroConfig;
|
||||
private final File cacheFile;
|
||||
private final File uuidCacheFile;
|
||||
public int reconnectSuppression;
|
||||
|
||||
public PurpleIRC() {
|
||||
this.MAINCONFIG = "MAIN-CONFIG";
|
||||
@ -205,6 +206,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
this.hostCache = new HashMap<>();
|
||||
this.cacheFile = new File("plugins/PurpleIRC/displayName.cache");
|
||||
this.uuidCacheFile = new File("plugins/PurpleIRC/uuid.cache");
|
||||
this.reconnectSuppression = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -691,6 +693,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
listSortByName = getConfig().getBoolean("list-sort-by-name", true);
|
||||
|
||||
ircConnCheckInterval = getConfig().getLong("conn-check-interval");
|
||||
reconnectSuppression = getConfig().getInt("reconnect-fail-message-count", 10);
|
||||
ircChannelCheckInterval = getConfig().getLong("channel-check-interval");
|
||||
|
||||
customTabGamemode = getConfig().getString("custom-tab-gamemode", "SPECTATOR");
|
||||
|
@ -6,6 +6,8 @@ update-checker: true
|
||||
update-checker-mode: stable
|
||||
# How often we check to see if a bot is connected to the IRC server. This is in server ticks (There 20 ticks in one sec).
|
||||
conn-check-interval: 1000
|
||||
# Suppress connection failure messages after this many reconnect attempts
|
||||
reconnect-fail-message-count: 10
|
||||
# Startup an ident server
|
||||
enable-ident-server: false
|
||||
# How often we check the channel user list
|
||||
|
Loading…
Reference in New Issue
Block a user