Skip to content

Commit 120c87d

Browse files
committed
fixed game not launching on separate thread
1 parent f3f0bf5 commit 120c87d

File tree

1 file changed

+15
-13
lines changed

1 file changed

+15
-13
lines changed

src/main/java/lol/hyper/customlauncher/login/LaunchGame.java

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -60,18 +60,20 @@ public void run() {
6060
Map<String, String> env = pb.environment();
6161
env.put("TTR_GAMESERVER", this.gameServer);
6262
env.put("TTR_PLAYCOOKIE", this.cookie);
63-
try {
64-
Process p = pb.start();
65-
p.getInputStream().close();
66-
} catch (IOException e) {
67-
logger.error("Unable to launch game!", e);
68-
JFrame errorWindow =
69-
new ErrorWindow(
70-
"Unable to launch game.\n"
71-
+ e.getClass().getCanonicalName()
72-
+ ": "
73-
+ e.getMessage());
74-
errorWindow.dispose();
75-
}
63+
Thread t1 = new Thread(() -> {
64+
try {
65+
pb.start();
66+
} catch (IOException e) {
67+
logger.error("Unable to launch game!", e);
68+
JFrame errorWindow =
69+
new ErrorWindow(
70+
"Unable to launch game.\n"
71+
+ e.getClass().getCanonicalName()
72+
+ ": "
73+
+ e.getMessage());
74+
errorWindow.dispose();
75+
}
76+
});
77+
t1.start();
7678
}
7779
}

0 commit comments

Comments
 (0)