mirror of
https://github.com/ViaVersion/ViaBackwards.git
synced 2024-12-23 17:08:00 +01:00
Cleanup outdated VV check
This commit is contained in:
parent
a25b002fa8
commit
a642e46eb3
@ -27,6 +27,7 @@ import nl.matsv.viabackwards.protocol.protocol1_14_3to1_14_4.Protocol1_14_3To1_1
|
|||||||
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.Protocol1_14_4To1_15;
|
import nl.matsv.viabackwards.protocol.protocol1_14_4to1_15.Protocol1_14_4To1_15;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_14to1_14_1.Protocol1_14To1_14_1;
|
import nl.matsv.viabackwards.protocol.protocol1_14to1_14_1.Protocol1_14To1_14_1;
|
||||||
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
import nl.matsv.viabackwards.protocol.protocol1_9_4to1_10.Protocol1_9_4To1_10;
|
||||||
|
import us.myles.ViaVersion.api.Via;
|
||||||
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
import us.myles.ViaVersion.api.protocol.ProtocolVersion;
|
||||||
import us.myles.ViaVersion.update.Version;
|
import us.myles.ViaVersion.update.Version;
|
||||||
|
|
||||||
@ -37,6 +38,8 @@ import static us.myles.ViaVersion.api.protocol.ProtocolRegistry.registerProtocol
|
|||||||
|
|
||||||
public interface ViaBackwardsPlatform {
|
public interface ViaBackwardsPlatform {
|
||||||
|
|
||||||
|
String MINIMUM_VV_VERSION = "3.0.0";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize ViaBackwards.
|
* Initialize ViaBackwards.
|
||||||
*/
|
*/
|
||||||
@ -73,21 +76,11 @@ public interface ViaBackwardsPlatform {
|
|||||||
Logger getLogger();
|
Logger getLogger();
|
||||||
|
|
||||||
default boolean isOutdated() {
|
default boolean isOutdated() {
|
||||||
String minimumVVVersion = "3.0.0";
|
String vvVersion = Via.getPlatform().getPluginVersion();
|
||||||
boolean upToDate = false;
|
if (vvVersion != null && new Version(vvVersion).compareTo(new Version(MINIMUM_VV_VERSION + "--")) < 0) {
|
||||||
try {
|
|
||||||
Class<?> vvVersionInfo = Class.forName("us.myles.ViaVersion.sponge.VersionInfo");
|
|
||||||
String vvVersion = (String) vvVersionInfo.getField("VERSION").get(null);
|
|
||||||
|
|
||||||
upToDate = (vvVersion != null
|
|
||||||
&& new Version(vvVersion).compareTo(new Version(minimumVVVersion + "--")) >= 0);
|
|
||||||
} catch (ClassNotFoundException | NoSuchFieldException | IllegalAccessException ignored) {
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!upToDate) {
|
|
||||||
getLogger().severe("================================");
|
getLogger().severe("================================");
|
||||||
getLogger().severe("YOUR VIAVERSION IS OUTDATED");
|
getLogger().severe("YOUR VIAVERSION IS OUTDATED");
|
||||||
getLogger().severe("PLEASE USE VIAVERSION " + minimumVVVersion + " OR NEWER");
|
getLogger().severe("PLEASE USE VIAVERSION " + MINIMUM_VV_VERSION + " OR NEWER");
|
||||||
getLogger().severe("LINK: https://viaversion.com");
|
getLogger().severe("LINK: https://viaversion.com");
|
||||||
getLogger().severe("VIABACKWARDS WILL NOW DISABLE");
|
getLogger().severe("VIABACKWARDS WILL NOW DISABLE");
|
||||||
getLogger().severe("================================");
|
getLogger().severe("================================");
|
||||||
|
Loading…
Reference in New Issue
Block a user