diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index d37fa9476..5b4588c7c 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -1669,7 +1669,7 @@ public class PS{ java.util.Scanner scanner = new java.util.Scanner(stream).useDelimiter("\\A"); String versionString = scanner.next().trim(); 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.BUILD = "https://ci.athion.net/job/PlotSquared/" + version.build; Settings.COMMIT = "https://github.com/IntellectualSites/PlotSquared/commit/" + Integer.toHexString(version.hash); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PlotVersion.java b/Core/src/main/java/com/intellectualcrafters/plot/PlotVersion.java index d0c6e82fc..937d0af73 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PlotVersion.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PlotVersion.java @@ -3,6 +3,23 @@ package com.intellectualcrafters.plot; public class PlotVersion { 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) { String[] split = version.substring(version.indexOf('=') + 1).split("-"); if (split[0].equals("unknown")) {