Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions src/main/java/com/globalchat/GlobalChatPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -232,21 +232,27 @@ protected void startUp() throws Exception {
// Check connection after a delay and notify user if failed
scheduler.schedule(() -> {
if (!ablyManager.isConnected()) {
clientThread.invokeLater(() -> {
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "",
"<col=ff9040>Global Chat connection issue - retrying...</col>", null);
return true;
});
// Only show message every 5 attempts to reduce spam
if (reconnectAttempts % 5 == 1) {
clientThread.invokeLater(() -> {
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "",
"<col=ff9040>Global Chat at connection limit (200 players max) - retrying... Support on Patreon to increase limits!</col>", null);
return true;
});
}
}
}, 2000, TimeUnit.MILLISECONDS);

} catch (Exception e) {
log.debug("Error during reconnection", e);
clientThread.invokeLater(() -> {
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "",
"<col=ff0000>Global Chat connection failed</col>", null);
return true;
});
// Only show error message every 5 attempts to reduce spam
if (reconnectAttempts % 5 == 1) {
clientThread.invokeLater(() -> {
client.addChatMessage(ChatMessageType.GAMEMESSAGE, "",
"<col=ff0000>Global Chat full - 200 player limit reached! Support on Patreon to increase connection limits!</col>", null);
return true;
});
}
}
});
}
Expand Down