From 2b2b36dbadf2eb75809f9a53e2a2c0b87c85508a Mon Sep 17 00:00:00 2001 From: hackthetime Date: Thu, 5 Oct 2023 13:49:09 +0200 Subject: bug fix for the Disconnect Packet not reconnecting. added a custom random delay to the Packet to allow setting a custom delay time server side to reduce load at the reconnect time. --- .../java/de/hype/bbsentials/communication/BBsentialConnection.java | 2 +- .../java/de/hype/bbsentials/packets/packets/DisconnectPacket.java | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java index 1d1e3c1..0d43bd9 100644 --- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java +++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java @@ -422,7 +422,7 @@ public class BBsentialConnection { else { BBsentials.conditionalReconnectToBBserver(); } - }, (long) (packet.waitBeforeReconnect[i] + (Math.random() * packet.random)), TimeUnit.SECONDS); + }, (long) (packet.waitBeforeReconnect[i] + (Math.random() * packet.randomExtraDelay)), TimeUnit.SECONDS); } } diff --git a/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java b/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java index ab04d1a..7cb461e 100644 --- a/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java +++ b/src/main/java/de/hype/bbsentials/packets/packets/DisconnectPacket.java @@ -5,16 +5,18 @@ import de.hype.bbsentials.constants.enviromentShared.InternalReasonConstants; public class DisconnectPacket extends AbstractPacket { - public DisconnectPacket(InternalReasonConstants internalReason, int[] waitBeforeReconnect, String displayReason, String displayMessage) { + public DisconnectPacket(InternalReasonConstants internalReason, int[] waitBeforeReconnect, int randomExtraDelay, String displayReason, String displayMessage) { super(1, 1); //Min and Max supportet Version this.internalReason = internalReason; this.waitBeforeReconnect = waitBeforeReconnect; this.displayReason = displayReason; this.displayMessage = displayMessage; + this.randomExtraDelay = randomExtraDelay; } public final InternalReasonConstants internalReason; public final int[] waitBeforeReconnect; + public final int randomExtraDelay; public final String displayReason; public final String displayMessage; -- cgit