3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-03 14:50:30 +01:00

Don't produce errors while ViaVersion is not active during boot, #686

Dieser Commit ist enthalten in:
Myles 2017-06-12 18:22:09 +01:00
Ursprung 188419feb0
Commit 10688a7067

Datei anzeigen

@ -70,7 +70,11 @@ public class BaseProtocol extends Protocol {
if (ProtocolRegistry.SERVER_PROTOCOL == -1) // Set the Server protocol if the detection on startup failed if (ProtocolRegistry.SERVER_PROTOCOL == -1) // Set the Server protocol if the detection on startup failed
ProtocolRegistry.SERVER_PROTOCOL = protocolVersion; 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()); int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
List<Pair<Integer, Protocol>> protocols = null; List<Pair<Integer, Protocol>> protocols = null;
@ -166,6 +170,11 @@ public class BaseProtocol extends Protocol {
ProtocolInfo info = wrapper.user().get(ProtocolInfo.class); ProtocolInfo info = wrapper.user().get(ProtocolInfo.class);
info.setProtocolVersion(protVer); 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 // Choose the pipe
int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user()); int protocol = Via.getManager().getProviders().get(VersionProvider.class).getServerProtocol(wrapper.user());
List<Pair<Integer, Protocol>> protocols = null; List<Pair<Integer, Protocol>> protocols = null;