From 10688a7067fc0e22ed8af0e80e6249092add5448 Mon Sep 17 00:00:00 2001 From: Myles Date: Mon, 12 Jun 2017 18:22:09 +0100 Subject: [PATCH] Don't produce errors while ViaVersion is not active during boot, #686 --- .../myles/ViaVersion/protocols/base/BaseProtocol.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java b/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java index ce709ba23..519005b28 100644 --- a/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java +++ b/common/src/main/java/us/myles/ViaVersion/protocols/base/BaseProtocol.java @@ -70,7 +70,11 @@ public class BaseProtocol extends Protocol { if (ProtocolRegistry.SERVER_PROTOCOL == -1) // Set the Server protocol if the detection on startup failed ProtocolRegistry.SERVER_PROTOCOL = protocolVersion; - + // Ensure the server has a version provider + if (Via.getManager().getProviders().get(VersionProvider.class) == null) { + wrapper.user().setActive(false); + return; + } int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user()); List> protocols = null; @@ -166,6 +170,11 @@ public class BaseProtocol extends Protocol { ProtocolInfo info = wrapper.user().get(ProtocolInfo.class); info.setProtocolVersion(protVer); + // Ensure the server has a version provider + if (Via.getManager().getProviders().get(VersionProvider.class) == null) { + wrapper.user().setActive(false); + return; + } // Choose the pipe int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user()); List> protocols = null;