mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
Fixes #1961
This commit is contained in:
parent
3039331976
commit
d454602888
@ -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);
|
||||||
|
@ -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")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user