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