From a4aabb5cbd29fda0f8c6aeac867602528e4fd618 Mon Sep 17 00:00:00 2001 From: hackthetime Date: Wed, 4 Oct 2023 09:07:14 +0200 Subject: tried fixing the splash update listener --- .../de/hype/bbsentials/client/SplashStatusUpdateListener.java | 8 +++----- .../de/hype/bbsentials/communication/BBsentialConnection.java | 3 +-- 2 files changed, 4 insertions(+), 7 deletions(-) (limited to 'src/main/java') diff --git a/src/main/java/de/hype/bbsentials/client/SplashStatusUpdateListener.java b/src/main/java/de/hype/bbsentials/client/SplashStatusUpdateListener.java index 6b5180a..2463c79 100644 --- a/src/main/java/de/hype/bbsentials/client/SplashStatusUpdateListener.java +++ b/src/main/java/de/hype/bbsentials/client/SplashStatusUpdateListener.java @@ -25,9 +25,8 @@ public class SplashStatusUpdateListener implements Runnable { @Override public void run() { BBsentials.splashLobby = true; + int maxPlayerCount = BBUtils.getMaximumPlayerCount() - 5; while (BBsentials.splashLobby) { - int maxPlayerCount = BBUtils.getMaximumPlayerCount() - 5; - while (splashLobby && !(status.equals(SplashUpdatePacket.STATUS_DONE) || status.equals(SplashUpdatePacket.STATUS_CANCELED))) { if (!full&&(BBUtils.getPlayerCount() >= maxPlayerCount)) { newStatus = SplashUpdatePacket.STATUS_FULL; full=true; @@ -36,10 +35,9 @@ public class SplashStatusUpdateListener implements Runnable { status = newStatus; connection.sendPacket(new SplashUpdatePacket(packet.splashId, status)); } - } try { - Thread.sleep(1000); - } catch (InterruptedException e) { + Thread.sleep(250); + } catch (InterruptedException ignored) { } } if (splashed) { diff --git a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java index abb5265..e6e5096 100644 --- a/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java +++ b/src/main/java/de/hype/bbsentials/communication/BBsentialConnection.java @@ -344,11 +344,10 @@ public class BBsentialConnection { public void onSplashNotifyPacket(SplashNotifyPacket packet) { int waitTime; - if (packet.splasherUsername.equals(config.getUsername())) { SplashStatusUpdateListener splashStatusUpdateListener = new SplashStatusUpdateListener(this, packet); BBsentials.splashStatusUpdateListener = splashStatusUpdateListener; - executionService.submit(splashStatusUpdateListener); + executionService.execute(splashStatusUpdateListener); } else { SplashManager.addSplash(packet); -- cgit