diff options
Diffstat (limited to 'src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java')
-rw-r--r-- | src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java index a40c621..33b1777 100644 --- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java +++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java @@ -66,7 +66,7 @@ public class BBsentialConnection { return true; } else { - BBsentials.bbserver.sendCommand("?emergency server-hacked? chchest command " + command); + BBsentials.connection.sendCommand("?emergency server-hacked? chchest command " + command); String emergencyMessage = "We detected that there was a command used which is not configured to be safe! " + command + " please check if its safe. IMMEDIATELY report this to the Admins and Developer Hype_the_Time (@hackthetime). If it is not safe immediately remove BBsentials!!!!!!!! "; System.out.println(emergencyMessage); Chat.sendPrivateMessageToSelf("ยง4" + emergencyMessage + "\n\n"); @@ -445,7 +445,12 @@ public class BBsentialConnection { } public void onDisconnectPacket(DisconnectPacket packet) { - + Chat.sendPrivateMessageToSelf(packet.displayMessage); + for (int i : packet.waitBeforeReconnect) { + executionService.schedule(() -> { + BBsentials.conditionalReconnectToBBserver(); + }, i, TimeUnit.SECONDS); + } } public void onDisplayMessagePacket(DisplayMessagePacket packet) { @@ -503,4 +508,13 @@ public class BBsentialConnection { public interface MessageReceivedCallback { void onMessageReceived(String message); } + + public boolean isConnected() { + try { + socket.isConnected(); + return true; + } catch (Exception e) { + return false; + } + } }
\ No newline at end of file |