Improve comments

This commit is contained in:
Shadowrs
2018-09-07 13:51:59 +01:00
parent c53853d359
commit 32a3a013aa
2 changed files with 7 additions and 1 deletions
@@ -164,16 +164,22 @@ public class ServerProviderInfo {
return settings;
}
/**
* Gets the URL to download the Randoms JAR from.
* @return The provided URL in the server config JSON (denoted by 'randoms:') or, fallback to the default BDN URL.
*/
public URL getRandoms() {
try {
String randomsUrl = properties.getProperty("randoms_jar");
if (randomsUrl == null || randomsUrl.length() == 0) {
// Fallback to default BDN URL if there is no 'randoms' specified in the server JSON configuration.
randomsUrl = Configuration.GET_RANDOMS + (Configuration.BOT_VERSION.isNightly() ? Configuration.NIGHTLY_APPEND : "");
}
return new URL(randomsUrl);
} catch (MalformedURLException e) {
e.printStackTrace();
}
// Will never return null, unless the BDN URL is changed. It shouldn't be.
return null;
}
}
@@ -27,7 +27,7 @@ public class PublicRandoms extends RandomParser {
final File destination = new File(Directories.getCachePath() + File.separator + fileName);
final URL overrideDownload = Context.getInstance().getServerProviderInfo().getRandoms();
if (overrideDownload == null) {
throw new NullPointerException("randoms() URL is null - expected to default to BDN URL!");
throw new NullPointerException("Unable to grab URL for Randoms jar. Default URL for BDN randoms must have changed!");
}
Core.verbose(String.format("[%s] Destination: %s | dl: %s", getClass().getName(), destination, overrideDownload));