This commit is contained in:
Jesse Boyd 2018-06-19 03:44:45 +10:00
parent 3039331976
commit d454602888
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
2 changed files with 18 additions and 1 deletions

View File

@ -1669,7 +1669,7 @@ public class PS{
java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A"); java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A");
String versionString = scanner.next().trim(); String versionString = scanner.next().trim();
scanner.close(); scanner.close();
this.version = new PlotVersion(versionString); this.version = PlotVersion.tryParse(versionString);
Settings.DATE = new Date(100 + version.year, version.month, version.day).toGMTString(); Settings.DATE = new Date(100 + version.year, version.month, version.day).toGMTString();
Settings.BUILD = "https://ci.athion.net/job/PlotSquared/" + version.build; Settings.BUILD = "https://ci.athion.net/job/PlotSquared/" + version.build;
Settings.COMMIT = "https://github.com/IntellectualSites/PlotSquared/commit/" + Integer.toHexString(version.hash); Settings.COMMIT = "https://github.com/IntellectualSites/PlotSquared/commit/" + Integer.toHexString(version.hash);

View File

@ -3,6 +3,23 @@ package com.intellectualcrafters.plot;
public class PlotVersion { public class PlotVersion {
public final int year, month, day, hash, build; public final int year, month, day, hash, build;
public PlotVersion(int year, int month, int day, int hash, int build) {
this.year = year;
this.month = month;
this.day = day;
this.hash = hash;
this.build = build;
}
public static PlotVersion tryParse(String version) {
try {
return new PlotVersion(version);
} catch (Exception ignore) {
ignore.printStackTrace();
return new PlotVersion(0, 0, 0, 0, 0);
}
}
public PlotVersion(String version) { public PlotVersion(String version) {
String[] split = version.substring(version.indexOf('=') + 1).split("-"); String[] split = version.substring(version.indexOf('=') + 1).split("-");
if (split[0].equals("unknown")) { if (split[0].equals("unknown")) {