From 4755809a629e8d7f5e7a852d9ee8c42a93750f42 Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 12 Apr 2014 19:06:58 +1000 Subject: [PATCH] Tigthen up access to getVersion - should help with some disconnects. Great spot by @thinkofdeath --- CraftBukkit-Patches/0124-Old-New-Version-Support.patch | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/CraftBukkit-Patches/0124-Old-New-Version-Support.patch b/CraftBukkit-Patches/0124-Old-New-Version-Support.patch index 7b55bfad49..b84958bca6 100644 --- a/CraftBukkit-Patches/0124-Old-New-Version-Support.patch +++ b/CraftBukkit-Patches/0124-Old-New-Version-Support.patch @@ -1,4 +1,4 @@ -From a075d1294c4170b06370a4ffdbc9aa912ff16640 Mon Sep 17 00:00:00 2001 +From 01dd91c59517cae31f9e755b93e87ac8893dfa6d Mon Sep 17 00:00:00 2001 From: md_5 Date: Sat, 12 Apr 2014 15:11:15 +1000 Subject: [PATCH] Old / New Version Support. @@ -28,7 +28,7 @@ index c738ab5..ec44fe3 100644 this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]); this.b.close(chatcomponenttext); diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 6789ca8..7eaf694 100644 +index 6789ca8..9842440 100644 --- a/src/main/java/net/minecraft/server/NetworkManager.java +++ b/src/main/java/net/minecraft/server/NetworkManager.java @@ -42,6 +42,19 @@ public class NetworkManager extends SimpleChannelInboundHandler { @@ -38,7 +38,7 @@ index 6789ca8..7eaf694 100644 + // Spigot Start + public static final AttributeKey protocolVersion = new AttributeKey("protocol_version"); + public static final int CURRENT_VERSION = 5; -+ public static int getVersion(net.minecraft.util.io.netty.util.AttributeMap attr) ++ public static int getVersion(Channel attr) + { + Integer ver = attr.attr( protocolVersion ).get(); + return ( ver != null ) ? ver : CURRENT_VERSION; @@ -78,7 +78,7 @@ index f6f870f..855e85e 100644 return (i & -128) == 0 ? 1 : ((i & -16384) == 0 ? 2 : ((i & -2097152) == 0 ? 3 : ((i & -268435456) == 0 ? 4 : 5))); diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java new file mode 100644 -index 0000000..011a9aa +index 0000000..7994daa --- /dev/null +++ b/src/main/java/net/minecraft/server/PacketEncoder.java @@ -0,0 +1,45 @@ @@ -115,7 +115,7 @@ index 0000000..011a9aa + if (integer == null) { + throw new IOException("Can\'t serialize unregistered packet"); + } else { -+ PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf, NetworkManager.getVersion(channelhandlercontext)); // Spigot ++ PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf, NetworkManager.getVersion(channelhandlercontext.channel())); // Spigot + + packetdataserializer.b(integer.intValue()); + packet.b(packetdataserializer);