use of com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion in project ViaVersion by ViaVersion.
the class ViaManagerImpl method onServerLoaded.
public void onServerLoaded() {
if (!protocolManager.getServerProtocolVersion().isKnown()) {
// Try again
loadServerProtocol();
}
// Check if there are any pipes to this version
ServerProtocolVersion protocolVersion = protocolManager.getServerProtocolVersion();
if (protocolVersion.isKnown()) {
if (platform.isProxy()) {
platform.getLogger().info("ViaVersion detected lowest supported version by the proxy: " + ProtocolVersion.getProtocol(protocolVersion.lowestSupportedVersion()));
platform.getLogger().info("Highest supported version by the proxy: " + ProtocolVersion.getProtocol(protocolVersion.highestSupportedVersion()));
if (debug) {
platform.getLogger().info("Supported version range: " + Arrays.toString(protocolVersion.supportedVersions().toArray(new int[0])));
}
} else {
platform.getLogger().info("ViaVersion detected server version: " + ProtocolVersion.getProtocol(protocolVersion.highestSupportedVersion()));
}
if (!protocolManager.isWorkingPipe()) {
platform.getLogger().warning("ViaVersion does not have any compatible versions for this server version!");
platform.getLogger().warning("Please remember that ViaVersion only adds support for versions newer than the server version.");
platform.getLogger().warning("If you need support for older versions you may need to use one or more ViaVersion addons too.");
platform.getLogger().warning("In that case please read the ViaVersion resource page carefully or use https://jo0001.github.io/ViaSetup");
platform.getLogger().warning("and if you're still unsure, feel free to join our Discord-Server for further assistance.");
} else if (protocolVersion.highestSupportedVersion() <= ProtocolVersion.v1_12_2.getVersion()) {
platform.getLogger().warning("This version of Minecraft is extremely outdated and support for it has reached its end of life. " + "You will still be able to run Via on this Minecraft version, but we are unlikely to provide any further fixes or help with problems specific to legacy Minecraft versions. " + "Please consider updating to give your players a better experience and to avoid issues that have long been fixed.");
}
}
checkJavaVersion();
// Check for unsupported plugins/software
unsupportedSoftwareWarning();
// Load Listeners / Tasks
protocolManager.onServerLoaded();
// Load Platform
loader.load();
// Common tasks
mappingLoadingTask = Via.getPlatform().runRepeatingSync(() -> {
if (protocolManager.checkForMappingCompletion()) {
mappingLoadingTask.cancel();
mappingLoadingTask = null;
}
}, 10L);
int serverProtocolVersion = protocolManager.getServerProtocolVersion().lowestSupportedVersion();
if (serverProtocolVersion < ProtocolVersion.v1_9.getVersion()) {
if (Via.getConfig().isSimulatePlayerTick()) {
Via.getPlatform().runRepeatingSync(new ViaIdleThread(), 1L);
}
}
if (serverProtocolVersion < ProtocolVersion.v1_13.getVersion()) {
if (Via.getConfig().get1_13TabCompleteDelay() > 0) {
Via.getPlatform().runRepeatingSync(new TabCompleteThread(), 1L);
}
}
// Refresh Versions
protocolManager.refreshVersions();
}
use of com.viaversion.viaversion.api.protocol.version.ServerProtocolVersion 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();
}
}
Aggregations