mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-22 02:25:57 +01:00
Fix updated versions of Netty on 1.8 (#2685)
* Fix new Netty versions on 1.8 * Fix on Netty 4.1.69.Final
This commit is contained in:
parent
7c8b136e1d
commit
eb8ac56b65
@ -7,10 +7,35 @@ import io.netty.channel.ChannelMetadata;
|
|||||||
import io.netty.channel.ChannelOutboundBuffer;
|
import io.netty.channel.ChannelOutboundBuffer;
|
||||||
import io.netty.channel.DefaultChannelConfig;
|
import io.netty.channel.DefaultChannelConfig;
|
||||||
import io.netty.channel.EventLoop;
|
import io.netty.channel.EventLoop;
|
||||||
|
import io.netty.util.Version;
|
||||||
|
|
||||||
import java.net.SocketAddress;
|
import java.net.SocketAddress;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class EmptyChannel extends AbstractChannel {
|
public class EmptyChannel extends AbstractChannel {
|
||||||
|
|
||||||
|
private static boolean updatedNetty = false;
|
||||||
|
|
||||||
|
static {
|
||||||
|
Map<String, Version> versionMap = Version.identify();
|
||||||
|
Version nettyVersion = versionMap.get("netty-common");
|
||||||
|
if (nettyVersion == null) nettyVersion = versionMap.get("netty-all");
|
||||||
|
|
||||||
|
if (nettyVersion != null) {
|
||||||
|
String[] split = nettyVersion.artifactVersion().split("\\.");
|
||||||
|
try {
|
||||||
|
int major = Integer.parseInt(split[0]);
|
||||||
|
int minor = Integer.parseInt(split[1]);
|
||||||
|
int revision = Integer.parseInt(split[2]);
|
||||||
|
|
||||||
|
if (major > 4 || minor > 1 || revision > 24) {
|
||||||
|
updatedNetty = true;
|
||||||
|
}
|
||||||
|
} catch (NumberFormatException | ArrayIndexOutOfBoundsException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private final ChannelConfig config = new DefaultChannelConfig(this);
|
private final ChannelConfig config = new DefaultChannelConfig(this);
|
||||||
|
|
||||||
public EmptyChannel(Channel parent) {
|
public EmptyChannel(Channel parent) {
|
||||||
@ -65,7 +90,7 @@ public class EmptyChannel extends AbstractChannel {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ChannelMetadata metadata() {
|
public ChannelMetadata metadata() {
|
||||||
return null;
|
return updatedNetty ? new ChannelMetadata(true) : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user