Search in sources :

Example 1 with ServerProtocolVersionRange

use of com.viaversion.viaversion.protocol.ServerProtocolVersionRange in project ViaVersion by ViaVersion.

the class ViaManagerImpl method loadServerProtocol.

private void loadServerProtocol() {
    try {
        ProtocolVersion serverProtocolVersion = ProtocolVersion.getProtocol(injector.getServerProtocolVersion());
        ServerProtocolVersion versionInfo;
        if (platform.isProxy()) {
            IntSortedSet supportedVersions = injector.getServerProtocolVersions();
            versionInfo = new ServerProtocolVersionRange(supportedVersions.firstInt(), supportedVersions.lastInt(), supportedVersions);
        } else {
            versionInfo = new ServerProtocolVersionSingleton(serverProtocolVersion.getVersion());
        }
        protocolManager.setServerProtocol(versionInfo);
    } catch (Exception e) {
        platform.getLogger().severe("ViaVersion failed to get the server protocol!");
        e.printStackTrace();
    }
}
Also used : ServerProtocolVersion(com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion) ServerProtocolVersionRange(com.viaversion.viaversion.protocol.ServerProtocolVersionRange) IntSortedSet(it.unimi.dsi.fastutil.ints.IntSortedSet) ServerProtocolVersion(com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion) ProtocolVersion(com.viaversion.viaversion.api.protocol.version.ProtocolVersion) ServerProtocolVersionSingleton(com.viaversion.viaversion.protocol.ServerProtocolVersionSingleton)

Aggregations

ProtocolVersion (com.viaversion.viaversion.api.protocol.version.ProtocolVersion)1 ServerProtocolVersion (com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion)1 ServerProtocolVersionRange (com.viaversion.viaversion.protocol.ServerProtocolVersionRange)1 ServerProtocolVersionSingleton (com.viaversion.viaversion.protocol.ServerProtocolVersionSingleton)1 IntSortedSet (it.unimi.dsi.fastutil.ints.IntSortedSet)1