Skip to content

Commit b02f04a

Browse files
committed
more random fixes
1 parent 9e0229d commit b02f04a

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
<groupId>lol.hyper</groupId>
2525
<artifactId>CustomLauncherRewrite</artifactId>
26-
<version>1.7.2</version>
26+
<version>1.8</version>
2727
<packaging>jar</packaging>
2828

2929
<properties>

src/main/java/lol/hyper/customlauncher/ConfigHandler.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,10 @@ public void loadConfig() {
8787
jsonObject = new JSONObject();
8888
} else {
8989
jsonObject = new JSONObject(JSONManager.readFile(CONFIG_FILE));
90+
if (!jsonObject.has("version")) {
91+
jsonObject.put("version", CONFIG_VERSION);
92+
JSONManager.writeFile(jsonObject, CONFIG_FILE);
93+
}
9094
if (jsonObject.getInt("version") != CONFIG_VERSION) {
9195
logger.warn("Config version is not correct! Somethings will not work correctly. Version should be " + CONFIG_VERSION + " but read " + jsonObject.getInt("version"));
9296
}

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,6 @@ private LoginRequest sendRequest(LoginRequest loginRequest) {
159159
post.setHeader("Content-type", "application/x-www-form-urlencoded");
160160

161161
List<NameValuePair> urlParameters = new ArrayList<>();
162-
logger.info(loginRequest.getRequestDetails());
163162
for (Map.Entry<String, String> entry : loginRequest.getRequestDetails().entrySet()) {
164163
urlParameters.add(new BasicNameValuePair(entry.getKey(), entry.getValue()));
165164
}

src/main/java/lol/hyper/customlauncher/updater/UpdateChecker.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import lol.hyper.customlauncher.generic.ErrorWindow;
2222
import lol.hyper.githubreleaseapi.GitHubRelease;
2323
import lol.hyper.githubreleaseapi.GitHubReleaseAPI;
24+
import lol.hyper.githubreleaseapi.ReleaseNotFoundException;
2425
import org.apache.commons.io.FileUtils;
2526
import org.apache.commons.lang3.SystemUtils;
2627
import org.apache.logging.log4j.LogManager;
@@ -44,7 +45,7 @@ public UpdateChecker(String currentVersion) {
4445
this.api = new GitHubReleaseAPI("CustomLauncherRewrite", "hyperdefined");
4546
} catch (IOException exception) {
4647
api = null;
47-
logger.error("Unable to look for updates! ", exception);
48+
logger.error("Unable to look for updates!", exception);
4849
ErrorWindow errorWindow = new ErrorWindow(null, exception);
4950
errorWindow.dispose();
5051
}
@@ -57,7 +58,15 @@ private void checkForUpdate(String currentVersion) {
5758
return;
5859
}
5960
String latestVersion = api.getLatestVersion().getTagVersion();
60-
GitHubRelease current = api.getReleaseByTag(currentVersion);
61+
GitHubRelease current;
62+
try {
63+
current = api.getReleaseByTag(currentVersion);
64+
} catch (ReleaseNotFoundException exception) {
65+
logger.error("Current version does not exist on GitHub!");
66+
ErrorWindow errorWindow = new ErrorWindow("It looks like you're running a version not present on GitHub.\nThis is the case if you're running in a dev environment!", null);
67+
errorWindow.dispose();
68+
return;
69+
}
6170
int behind = api.getBuildsBehind(current);
6271
StringBuilder updates = new StringBuilder();
6372
// if the user is 1 or more build behind, ask to update

0 commit comments

Comments
 (0)