Fixes version lookup

This commit is contained in:
Sotr
2018-05-25 23:14:11 +08:00
parent 25e0d1fc43
commit 270a5d84f1

View File

@@ -68,13 +68,16 @@ public class MixinVersionCommand {
long current = System.currentTimeMillis();
if (current - lastCheckMillis > 7200000 /* 2 hours */) {
lastCheckMillis = current;
obtainVersion(sender);
/* TODO Option: legacy-versioning-compat */ currentSender = sender;
hasVersion = false;
} else {
sender.sendMessage(versionMessage);
return;
}
}
if (!hasVersion) {
obtainVersion(sender);
/* TODO Option: legacy-versioning-compat */ currentSender = sender;
}
}
private CommandSender currentSender;
@@ -98,6 +101,7 @@ public class MixinVersionCommand {
MCUtil.scheduleAsyncTask(() -> {
// This should be lying in 'sendVersion' method, but comes here for relax main thread
versionWaiters.add(sender);
sender.sendMessage("Checking version, please wait...");
String version = Bukkit.getVersion();
if (version == null) {
@@ -107,7 +111,6 @@ public class MixinVersionCommand {
}
if (version.startsWith("git-Akarin-")) {
String[] parts = version.substring("git-Akarin-".length()).split("[-\\s]");
int distance = getDistance(null, parts[0]);
switch (distance) {
@@ -126,7 +129,6 @@ public class MixinVersionCommand {
} else {
customVersion = true;
}
versionObtaining = false;
});
}