Merge pull request #282 from Shadowrs/docs

Docs for -debug
This commit is contained in:
Jeroen Ketelaar
2018-10-17 23:38:52 -05:00
committed by GitHub
2 changed files with 8 additions and 4 deletions
+1
View File
@@ -73,6 +73,7 @@ public final class Landing {
System.exit(0); System.exit(0);
break; break;
case "-debug": case "-debug":
case "-offlinemode":
Core.setDebug(true); Core.setDebug(true);
break; break;
case "-v": case "-v":
+7 -4
View File
@@ -29,7 +29,7 @@ import java.security.NoSuchAlgorithmException;
public class Core { public class Core {
private static int quickLaunchByUuid = -1; // used like -server, but denoted by an Int rather than the server name private static int quickLaunchByUuid = -1; // used like -server, but denoted by an Int rather than the server name
private static boolean debug; // in debug mode, we will print more detailed error messages. private static boolean debug; // Debug mode is Offline Mode. No BDN connection for Servers/Scripts/User Login. Not related to debug messages.
private static boolean verbose; private static boolean verbose;
private static boolean dump; private static boolean dump;
private static boolean loadLocal; //Loads both local and public scripts/servers private static boolean loadLocal; //Loads both local and public scripts/servers
@@ -72,7 +72,7 @@ public class Core {
} }
/** /**
* Enabled debug mode * Set debug mode AKA Offline Mode. If true, BDN login will be skipped, so BDN Servers or Scripts will be unavailable.
* *
* @param debug * @param debug
*/ */
@@ -104,7 +104,7 @@ public class Core {
} }
/** /**
* @return if the client is in debug mode. * @return if the client is in debug mode AKA Offline Mode. BDN Servers and Scripts are unavailable.
*/ */
public static boolean inDebugMode() { public static boolean inDebugMode() {
return debug; return debug;
@@ -170,7 +170,9 @@ public class Core {
String result; String result;
if ((result = WebUtil.getContents(String.format(Configuration.COMPARE_CHECKSUM_URL, "client", currentVersion.get()), "checksum=" + URLEncoder.encode(sb.toString(), "UTF-8"))) != null) { if ((result = WebUtil.getContents(String.format(Configuration.COMPARE_CHECKSUM_URL, "client", currentVersion.get()), "checksum=" + URLEncoder.encode(sb.toString(), "UTF-8"))) != null) {
JSONObject object = (JSONObject) WebUtil.getJsonParser().parse(result); JSONObject object = (JSONObject) WebUtil.getJsonParser().parse(result);
return (boolean) object.get("result"); boolean upToDate = (boolean) object.get("result");
Core.verbose("Local checksum: " + URLEncoder.encode(sb.toString(), "UTF-8") + ". " + (upToDate ? "This matches BDN and is up to date." : "BDN mismatch, must be Out Of Date."));
return upToDate;
} }
} }
} catch (NoSuchAlgorithmException | ParseException | IOException | URISyntaxException e) { } catch (NoSuchAlgorithmException | ParseException | IOException | URISyntaxException e) {
@@ -196,6 +198,7 @@ public class Core {
if (!latest) { if (!latest) {
Directories.clearCache(); Directories.clearCache();
} }
Core.verbose("Local version: " + currentVersion.get() + ". " + (latest ? "This is up to date." : "This is Out Of Date. Cache will be cleared."));
return latest; return latest;
} }
} catch (IOException | ParseException e) { } catch (IOException | ParseException e) {