From a5c947998b7dd69805b8c84d96a4d817de1cbb24 Mon Sep 17 00:00:00 2001 From: filoghost Date: Fri, 3 Mar 2017 22:19:55 +0100 Subject: [PATCH] Fixes #42 --- .../filoghost/holographicdisplays/SimpleUpdater.java | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/SimpleUpdater.java b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/SimpleUpdater.java index db7fca32..01251b0e 100644 --- a/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/SimpleUpdater.java +++ b/HolographicDisplays/Plugin/com/gmail/filoghost/holographicdisplays/SimpleUpdater.java @@ -57,14 +57,11 @@ public final class SimpleUpdater { JSONArray filesArray = (JSONArray) readJson("https://api.curseforge.com/servermods/files?projectIds=" + projectId); if (filesArray.size() == 0) { - // The array cannot be empty, there must be at least one file. The project ID is not valid. - plugin.getLogger().warning("The author of this plugin has misconfigured the Updater system."); - plugin.getLogger().warning("The project ID (" + projectId + ") provided for updating is invalid."); - plugin.getLogger().warning("Please notify the author of this error."); + // The array cannot be empty, there must be at least one file. The project ID is not valid or curse returned a wrong response. return; } - String updateName = (String) ((JSONObject) filesArray.get(filesArray.size() - 1)).get("name"); + String updateName = (String) ((JSONObject) filesArray.get(filesArray.size() - 1)).get("name"); final String newVersion = extractVersion(updateName); if (newVersion == null) { @@ -92,7 +89,7 @@ public final class SimpleUpdater { plugin.getLogger().warning("Unable to check for updates: unhandled exception."); } - } + } }); updaterThread.start(); } @@ -129,7 +126,7 @@ public final class SimpleUpdater { throw new IllegalArgumentException("fetched version's format is incorrect"); } - // Remove all the "v" from the versions, replace multiple full stops with a single full stop, and split them. + // Remove all the "v" from the versions, replace multiple full stops with a single full stop, and split them. String[] pluginVersionSplit = pluginVersion.replace("v", "").replaceAll("[\\.]{2,}", ".").split("\\."); String[] remoteVersionSplit = remoteVersion.replace("v", "").replaceAll("[\\.]{2,}", ".").split("\\.");