4.0.1 Release

This commit is contained in:
KennyTV 2021-07-05 18:21:26 +02:00
parent 9f97a09942
commit b28f743306
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
4 changed files with 25 additions and 4 deletions

View File

@ -77,7 +77,7 @@ public class ProtocolVersion {
public static final ProtocolVersion v1_16_3 = register(753, "1.16.3");
public static final ProtocolVersion v1_16_4 = register(754, "1.16.4/5", new VersionRange("1.16", 4, 5));
public static final ProtocolVersion v1_17 = register(755, "1.17");
public static final ProtocolVersion v1_17_1 = register(756, 40, "1.17.1");
public static final ProtocolVersion v1_17_1 = register(756, "1.17.1");
public static final ProtocolVersion unknown = register(-1, "UNKNOWN");
public static ProtocolVersion register(int version, String name) {

View File

@ -1,5 +1,5 @@
# Project properties - we put these here so they can be modified without causing a recompile of the build scripts
projectVersion=4.0.1-1.17.1-rc2-SNAPSHOT
projectVersion=4.0.1
# Gradle properties
org.gradle.daemon=true

View File

@ -82,6 +82,18 @@ public class VelocityPlugin implements ViaPlatform<Player> {
@Subscribe
public void onProxyInit(ProxyInitializeEvent e) {
if (!hasConnectionEvent()) {
// No way to disable the plugin :(
Logger logger = this.loggerslf4j;
logger.error(" / \\");
logger.error(" / \\");
logger.error(" / | \\");
logger.error(" / | \\ VELOCITY 3.0.0 IS REQUIRED");
logger.error(" / \\ VIAVERSION WILL NOT WORK AS INTENDED");
logger.error(" / o \\");
logger.error("/_____________\\");
}
PROXY = proxy;
VelocityCommandHandler commandHandler = new VelocityCommandHandler();
PROXY.getCommandManager().register("viaver", commandHandler, "vvvelocity", "viaversion");
@ -231,4 +243,13 @@ public class VelocityPlugin implements ViaPlatform<Player> {
public java.util.logging.Logger getLogger() {
return logger;
}
private boolean hasConnectionEvent() {
try {
Class.forName("com.velocitypowered.proxy.protocol.VelocityConnectionEvent");
return true;
} catch (ClassNotFoundException ignored) {
return false;
}
}
}

View File

@ -57,13 +57,14 @@ public class VelocityViaInjector implements ViaInjector {
@Override
public void inject() throws Exception {
Via.getPlatform().getLogger().info("Replacing channel initializers; you can safely ignore the following two warnings.");
Object connectionManager = ReflectionUtil.get(VelocityPlugin.PROXY, "cm", Object.class);
Object channelInitializerHolder = ReflectionUtil.invoke(connectionManager, "getServerChannelInitializer");
ChannelInitializer originalInitializer = getInitializer();
channelInitializerHolder.getClass().getMethod("set", ChannelInitializer.class)
.invoke(channelInitializerHolder, new VelocityChannelInitializer(originalInitializer, false));
Object backendInitializerHolder = ReflectionUtil.invoke(connectionManager, "getBackendChannelInitializer");
ChannelInitializer backendInitializer = getBackendInitializer();
backendInitializerHolder.getClass().getMethod("set", ChannelInitializer.class)
@ -75,7 +76,6 @@ public class VelocityViaInjector implements ViaInjector {
Via.getPlatform().getLogger().severe("ViaVersion cannot remove itself from Velocity without a reboot!");
}
@Override
public int getServerProtocolVersion() throws Exception {
return getLowestSupportedProtocolVersion();