Skip to content

Commit 7387ff4

Browse files
committed
java 16 bump
1 parent 98f6243 commit 7387ff4

File tree

4 files changed

+56
-78
lines changed

4 files changed

+56
-78
lines changed

pom.xml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
<packaging>jar</packaging>
2828

2929
<properties>
30-
<java.version>1.8</java.version>
30+
<java.version>16</java.version>
3131
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
3232
</properties>
3333

@@ -80,7 +80,7 @@
8080
<headerType>gui</headerType>
8181
<jar>${project.build.directory}/CustomLauncherRewrite-${project.version}.jar</jar>
8282
<outfile>${project.build.directory}/CustomLauncherRewrite-${project.version}.exe</outfile>
83-
<downloadUrl>https://adoptium.net/releases.html?variant=openjdk8&amp;jvmVariant=hotspot</downloadUrl>
83+
<downloadUrl>https://adoptium.net/releases.html?variant=openjdk16&amp;jvmVariant=hotspot</downloadUrl>
8484
<icon>src/main/resources/icon.ico</icon>
8585
<classPath>
8686
<mainClass>lol.hyper.customlauncher.Main</mainClass>
@@ -141,7 +141,7 @@
141141
<dependency>
142142
<groupId>commons-io</groupId>
143143
<artifactId>commons-io</artifactId>
144-
<version>2.8.0</version>
144+
<version>2.11.0</version>
145145
</dependency>
146146
<dependency>
147147
<groupId>org.apache.commons</groupId>
@@ -163,14 +163,11 @@
163163
<artifactId>commons-lang3</artifactId>
164164
<version>3.12.0</version>
165165
</dependency>
166+
<dependency>
167+
<groupId>javax.xml.bind</groupId>
168+
<artifactId>jaxb-api</artifactId>
169+
<version>2.3.1</version>
170+
</dependency>
166171
</dependencies>
167172

168-
<repositories>
169-
<repository>
170-
<id>dsol-xml</id>
171-
<name>Simulation @ TU Delft</name>
172-
<url>https://simulation.tudelft.nl/maven/</url>
173-
</repository>
174-
</repositories>
175-
176173
</project>

src/main/java/lol/hyper/customlauncher/accounts/Account.java

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,7 @@
1717

1818
package lol.hyper.customlauncher.accounts;
1919

20-
public class Account {
21-
22-
private final String username;
23-
private final String password;
24-
25-
/**
26-
* Create a new account object.
27-
*
28-
* @param username Username of account.
29-
* @param password Password of account. Must be encrypted.
30-
*/
31-
public Account(String username, String password) {
32-
this.username = username;
33-
this.password = password;
34-
}
20+
public record Account(String username, String password) {
3521

3622
/**
3723
* Returns the username of an account.

src/main/java/lol/hyper/customlauncher/accounts/JSONManager.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,7 @@ public static void convertToNewFormat() {
207207

208208
while (keys.hasNext()) {
209209
String key = keys.next();
210-
if (oldFile.get(key) instanceof JSONObject) {
211-
JSONObject temp = (JSONObject) oldFile.get(key);
210+
if (oldFile.get(key) instanceof JSONObject temp) {
212211
newFile.put(temp);
213212
}
214213
}

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

Lines changed: 46 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -79,58 +79,54 @@ public static void handleLoginRequest(LoginRequest loginRequest) {
7979

8080
// act based on the login status
8181
switch (status) {
82-
case "false": // false is invalid login details
83-
{
84-
if (banner.contains("Incorrect username")) {
85-
logger.info("Username or password is wrong.");
86-
JFrame errorWindow = new ErrorWindow("Login details are incorrect.");
87-
errorWindow.dispose();
82+
case "false" -> // false is invalid login details
83+
{
84+
if (banner.contains("Incorrect username")) {
85+
logger.info("Username or password is wrong.");
86+
JFrame errorWindow = new ErrorWindow("Login details are incorrect.");
87+
errorWindow.dispose();
88+
}
89+
}
90+
case "partial" -> // partial is used for 2FA or ToonGuard
91+
{
92+
logger.info("Asking user for two-factor auth.");
93+
JFrame twoFactorAuth =
94+
new TwoFactorAuth("Enter Code", banner, request.get("responseToken"));
95+
}
96+
case "true" -> // login was successful
97+
{
98+
logger.info("Login successful, launching game.");
99+
String gameServer = request.get("gameserver");
100+
String cookie = request.get("cookie");
101+
LaunchGame launchGame = new LaunchGame(cookie, gameServer);
102+
launchGame.start();
88103
}
89-
break;
90-
}
91-
case "partial": // partial is used for 2FA or ToonGuard
92-
{
93-
logger.info("Asking user for two-factor auth.");
94-
JFrame twoFactorAuth =
95-
new TwoFactorAuth("Enter Code", banner, request.get("responseToken"));
96-
break;
97-
}
98-
case "true": // login was successful
99-
{
100-
logger.info("Login successful, launching game.");
101-
String gameServer = request.get("gameserver");
102-
String cookie = request.get("cookie");
103-
LaunchGame launchGame = new LaunchGame(cookie, gameServer);
104-
launchGame.start();
105-
break;
106-
}
107-
case "delayed": // login request was put into a queue
108-
{
109-
logger.info("Stuck in queue.");
110-
JFrame infoWindow =
111-
new InfoWindow(
112-
"You were placed in a queue. Press OK to try again in 5 seconds.");
113-
infoWindow.dispose();
114-
try {
115-
TimeUnit.SECONDS.sleep(5);
116-
} catch (InterruptedException e) {
117-
logger.error(e);
104+
case "delayed" -> // login request was put into a queue
105+
{
106+
logger.info("Stuck in queue.");
107+
JFrame infoWindow =
108+
new InfoWindow(
109+
"You were placed in a queue. Press OK to try again in 5 seconds.");
110+
infoWindow.dispose();
111+
try {
112+
TimeUnit.SECONDS.sleep(5);
113+
} catch (InterruptedException e) {
114+
logger.error(e);
115+
}
116+
// send the login request again after 5 seconds
117+
LoginRequest newLoginRequest = new LoginRequest();
118+
newLoginRequest.addDetails("queueToken", request.get("queueToken"));
119+
LoginHandler.handleLoginRequest(newLoginRequest);
120+
}
121+
default -> // TTR sent back a weird status that we don't know about
122+
{
123+
logger.error("Weird login response: " + status);
124+
logger.info(request);
125+
JFrame errorWindow =
126+
new ErrorWindow(
127+
"TTR sent back a weird response, or we got an invalid response.\nCheck the log for more information.");
128+
errorWindow.dispose();
118129
}
119-
// send the login request again after 5 seconds
120-
LoginRequest newLoginRequest = new LoginRequest();
121-
newLoginRequest.addDetails("queueToken", request.get("queueToken"));
122-
LoginHandler.handleLoginRequest(newLoginRequest);
123-
break;
124-
}
125-
default: // TTR sent back a weird status that we don't know about
126-
{
127-
logger.error("Weird login response: " + status);
128-
logger.info(request);
129-
JFrame errorWindow =
130-
new ErrorWindow(
131-
"TTR sent back a weird response, or we got an invalid response.\nCheck the log for more information.");
132-
errorWindow.dispose();
133-
}
134130
}
135131
}
136132

0 commit comments

Comments
 (0)