diff options
author | Äkwav <xekwavx@gmail.com> | 2022-03-23 17:40:59 +0100 |
---|---|---|
committer | Äkwav <xekwavx@gmail.com> | 2022-03-23 17:40:59 +0100 |
commit | e8569cb30684fdbffdfdfc619912a2ba8c232512 (patch) | |
tree | d2cf76200537ea22a1abe92ab5ebd229a2158fac | |
parent | b5a680e8fcea1bd0e491ae5725fbacaf372f748e (diff) | |
download | COFL-e8569cb30684fdbffdfdfc619912a2ba8c232512.tar.gz COFL-e8569cb30684fdbffdfdfc619912a2ba8c232512.tar.bz2 COFL-e8569cb30684fdbffdfdfc619912a2ba8c232512.zip |
fix reconnect
-rw-r--r-- | src/main/java/de/torui/coflsky/network/WSClientWrapper.java | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/main/java/de/torui/coflsky/network/WSClientWrapper.java b/src/main/java/de/torui/coflsky/network/WSClientWrapper.java index e6592bb..044a3e2 100644 --- a/src/main/java/de/torui/coflsky/network/WSClientWrapper.java +++ b/src/main/java/de/torui/coflsky/network/WSClientWrapper.java @@ -41,16 +41,18 @@ public class WSClientWrapper { System.out.println("Sleeping..."); Minecraft.getMinecraft().thePlayer.addChatMessage(new ChatComponentText("Lost connection to Coflnet, trying to reestablish the connection in 2 Seconds...")); - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - socket = new WSClient(socket.uri); - isRunning = false; - start(); + isRunning = false; + while(isRunning == false) { + start(); + try { + Thread.sleep(2000); + } catch (InterruptedException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + socket.shouldRun = true; } |