From 29f560cc2d3fcaa4e741b4db35af1ed154da9e96 Mon Sep 17 00:00:00 2001 From: HacktheTime Date: Tue, 26 Sep 2023 19:49:04 +0200 Subject: lots of bug fixes and improved punishment system ba making it as custom packet. --- .../bbsentials/communication/BBsentialConnection.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'src/main/java/de/hype/bbsentials/communication') 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 -- cgit