diff options
author | HacktheTime <l4bg0jb7@duck.com> | 2023-12-14 16:21:26 +0100 |
---|---|---|
committer | HacktheTime <l4bg0jb7@duck.com> | 2023-12-15 18:17:42 +0100 |
commit | 127dcc12a982b7b31a098f8f1e011725ead62d9b (patch) | |
tree | 73c18cc21c4633430369f676e7758a2c71a5519a /common | |
parent | f8ab64f88f69ec50d5aca562f0ddbbf6ff7b0a34 (diff) | |
download | BBsentials-127dcc12a982b7b31a098f8f1e011725ead62d9b.tar.gz BBsentials-127dcc12a982b7b31a098f8f1e011725ead62d9b.tar.bz2 BBsentials-127dcc12a982b7b31a098f8f1e011725ead62d9b.zip |
reformatting and bug fixes
Diffstat (limited to 'common')
-rw-r--r-- | common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java index b89cfc1..8898e20 100644 --- a/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java +++ b/common/src/main/java/de/hype/bbsentials/common/client/SplashStatusUpdateListener.java @@ -4,17 +4,16 @@ import de.hype.bbsentials.common.communication.BBsentialConnection; import de.hype.bbsentials.common.mclibraries.EnvironmentCore; import de.hype.bbsentials.common.packets.packets.SplashNotifyPacket; import de.hype.bbsentials.common.packets.packets.SplashUpdatePacket; -import sun.java2d.pipe.TextRenderer; import java.util.concurrent.TimeUnit; public class SplashStatusUpdateListener implements Runnable { - BBsentialConnection connection; - SplashNotifyPacket packet; - private String status = SplashUpdatePacket.STATUS_WAITING; public String newStatus = SplashUpdatePacket.STATUS_WAITING; public boolean splashed = false; public boolean full = false; + BBsentialConnection connection; + SplashNotifyPacket packet; + private String status = SplashUpdatePacket.STATUS_WAITING; public SplashStatusUpdateListener(BBsentialConnection connection, SplashNotifyPacket packet) { this.connection = connection; @@ -27,14 +26,14 @@ public class SplashStatusUpdateListener implements Runnable { int maxPlayerCount = EnvironmentCore.utils.getMaximumPlayerCount() - 5; while (BBsentials.splashLobby) { - if (!full&&(EnvironmentCore.utils.getPlayerCount() >= maxPlayerCount)) { - newStatus = SplashUpdatePacket.STATUS_FULL; - full=true; - } - if (!status.equals(newStatus)) { - status = newStatus; - connection.sendPacket(new SplashUpdatePacket(packet.splashId, status)); - } + if (!full && (EnvironmentCore.utils.getPlayerCount() >= maxPlayerCount)) { + newStatus = SplashUpdatePacket.STATUS_FULL; + full = true; + } + if (!status.equals(newStatus)) { + status = newStatus; + connection.sendPacket(new SplashUpdatePacket(packet.splashId, status)); + } try { Thread.sleep(250); } catch (InterruptedException ignored) { @@ -51,10 +50,11 @@ public class SplashStatusUpdateListener implements Runnable { connection.sendPacket(new SplashUpdatePacket(packet.splashId, status)); } } + public void setStatus(String newStatus) { this.newStatus = newStatus; if (newStatus.equals(SplashUpdatePacket.STATUS_SPLASHING)) { - splashed=true; + splashed = true; BBsentials.executionService.schedule(() -> { setStatus(SplashUpdatePacket.STATUS_DONE); BBsentials.splashLobby = false; |