mirror of
https://github.com/2006-Scape/Parabot.git
synced 2026-07-03 00:37:55 +00:00
[CLEANUP] Added “-nightly” if it’s nightly to jar
This commit is contained in:
@@ -73,7 +73,7 @@
|
||||
<dependency>
|
||||
<groupId>org.parabot</groupId>
|
||||
<artifactId>internal-api</artifactId>
|
||||
<version>1.4.4</version>
|
||||
<version>1.4.41</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -24,6 +24,4 @@ public class Configuration extends org.parabot.api.Configuration {
|
||||
public static final String ITEM_API = DATA_API + "items/";
|
||||
|
||||
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
|
||||
|
||||
public static final String NIGHTLY_APPEND = "?nightly=true";
|
||||
}
|
||||
|
||||
@@ -19,9 +19,11 @@ import java.net.URLClassLoader;
|
||||
*/
|
||||
public class PublicRandoms extends RandomParser {
|
||||
|
||||
private String fileName = ((Configuration.BOT_VERSION.isNightly()) ? "randoms-nightly.jar" : "randoms.jar");
|
||||
|
||||
@Override
|
||||
public void parse() {
|
||||
File myJar = new File(Directories.getCachePath() + "/randoms.jar");
|
||||
File myJar = new File(Directories.getCachePath() + File.separator + fileName);
|
||||
if (!myJar.exists() || !myJar.canRead()) {
|
||||
download();
|
||||
}
|
||||
@@ -45,13 +47,13 @@ public class PublicRandoms extends RandomParser {
|
||||
|
||||
private void download() {
|
||||
try {
|
||||
File random = new File(Directories.getCachePath() + File.separator + "randoms.jar");
|
||||
File random = new File(Directories.getCachePath() + File.separator + fileName);
|
||||
if (random.exists()) {
|
||||
Core.verbose("Public random dependency already exists, no need to download it...");
|
||||
return;
|
||||
}
|
||||
|
||||
String downloadLink = ((Configuration.BOT_VERSION.isNightly()) ? Configuration.GET_RANDOMS + "?stable=false" : Configuration.GET_RANDOMS);
|
||||
String downloadLink = ((Configuration.BOT_VERSION.isNightly()) ? Configuration.GET_RANDOMS + Configuration.NIGHTLY_APPEND : Configuration.GET_RANDOMS);
|
||||
|
||||
WebUtil.downloadFile(new URL(downloadLink), random, new NoProgressListener());
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user