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>
|
<dependency>
|
||||||
<groupId>org.parabot</groupId>
|
<groupId>org.parabot</groupId>
|
||||||
<artifactId>internal-api</artifactId>
|
<artifactId>internal-api</artifactId>
|
||||||
<version>1.4.4</version>
|
<version>1.4.41</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</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 String ITEM_API = DATA_API + "items/";
|
||||||
|
|
||||||
public static final Version BOT_VERSION = ProjectProperties.getProjectVersion();
|
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 {
|
public class PublicRandoms extends RandomParser {
|
||||||
|
|
||||||
|
private String fileName = ((Configuration.BOT_VERSION.isNightly()) ? "randoms-nightly.jar" : "randoms.jar");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void parse() {
|
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()) {
|
if (!myJar.exists() || !myJar.canRead()) {
|
||||||
download();
|
download();
|
||||||
}
|
}
|
||||||
@@ -45,13 +47,13 @@ public class PublicRandoms extends RandomParser {
|
|||||||
|
|
||||||
private void download() {
|
private void download() {
|
||||||
try {
|
try {
|
||||||
File random = new File(Directories.getCachePath() + File.separator + "randoms.jar");
|
File random = new File(Directories.getCachePath() + File.separator + fileName);
|
||||||
if (random.exists()) {
|
if (random.exists()) {
|
||||||
Core.verbose("Public random dependency already exists, no need to download it...");
|
Core.verbose("Public random dependency already exists, no need to download it...");
|
||||||
return;
|
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());
|
WebUtil.downloadFile(new URL(downloadLink), random, new NoProgressListener());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user