3
0
Mirror von https://github.com/ViaVersion/ViaBackwards.git synchronisiert 2024-12-27 16:40:12 +01:00

Cleanup outdated VV check

Dieser Commit ist enthalten in:
KennyTV 2019-12-11 12:35:55 +01:00
Ursprung a25b002fa8
Commit a642e46eb3

Datei anzeigen

@ -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("================================");