Fix a critial bug that prevents PB from loading.

This was caused by a previous patch that corrected the version parser 
for special Spigot versions with a snapshot protocol enabled. 
Unfortunately, this also causes the comparer to fail on normal 
version ...

Somehow, that got through testing.
This commit is contained in:
Kristian S. Stangeland 2013-10-06 02:31:55 +02:00
parent e4c193440e
commit c2abc4277b
2 changed files with 10 additions and 8 deletions

View File

@ -71,7 +71,7 @@ public class ProtocolLibrary extends JavaPlugin {
public static final ReportType REPORT_METRICS_IO_ERROR = new ReportType("Unable to enable metrics due to network problems.");
public static final ReportType REPORT_METRICS_GENERIC_ERROR = new ReportType("Unable to enable metrics due to network problems.");
public static final ReportType REPORT_CANNOT_PARSE_MINECRAFT_VERSION = new ReportType("Unable to retrieve current Minecraft version.");
public static final ReportType REPORT_CANNOT_PARSE_MINECRAFT_VERSION = new ReportType("Unable to retrieve current Minecraft version. Assuming %s");
public static final ReportType REPORT_CANNOT_DETECT_CONFLICTING_PLUGINS = new ReportType("Unable to detect conflicting plugin versions.");
public static final ReportType REPORT_CANNOT_REGISTER_COMMAND = new ReportType("Cannot register command %s: %s");
@ -367,9 +367,10 @@ public class ProtocolLibrary extends JavaPlugin {
// Used to check Minecraft version
private MinecraftVersion verifyMinecraftVersion() {
try {
MinecraftVersion minimum = new MinecraftVersion(MINIMUM_MINECRAFT_VERSION);
MinecraftVersion maximum = new MinecraftVersion(MAXIMUM_MINECRAFT_VERSION);
try {
MinecraftVersion current = new MinecraftVersion(getServer());
// Skip certain versions
@ -383,11 +384,12 @@ public class ProtocolLibrary extends JavaPlugin {
return current;
} catch (Exception e) {
reporter.reportWarning(this, Report.newBuilder(REPORT_CANNOT_PARSE_MINECRAFT_VERSION).error(e));
}
reporter.reportWarning(this,
Report.newBuilder(REPORT_CANNOT_PARSE_MINECRAFT_VERSION).error(e).messageParam(maximum));
// Unknown version
return null;
// Unknown version - just assume it is the latest
return maximum;
}
}
private void checkConflictingVersions() {

View File

@ -218,7 +218,7 @@ public class MinecraftVersion implements Comparable<MinecraftVersion> {
compare(getBuild(), o.getBuild()).
// No development String means it's a release
compare(getDevelopmentStage(), o.getDevelopmentStage(), Ordering.natural().nullsLast()).
compare(getSnapshot(), o.getSnapshot()).
compare(getSnapshot(), o.getSnapshot(), Ordering.natural().nullsFirst()).
result();
}