From c43f25e23b68f684e1ed06ee42e9d0e6cffa62b6 Mon Sep 17 00:00:00 2001 From: md_5 Date: Fri, 15 Jul 2016 23:45:38 +1000 Subject: [PATCH] Fix MC|Brand array having trailing zeroes. --- proxy/src/main/java/net/md_5/bungee/ServerConnector.java | 2 +- .../main/java/net/md_5/bungee/connection/DownstreamBridge.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java index dd00192c..977b3def 100644 --- a/proxy/src/main/java/net/md_5/bungee/ServerConnector.java +++ b/proxy/src/main/java/net/md_5/bungee/ServerConnector.java @@ -199,7 +199,7 @@ public class ServerConnector extends PacketHandler ByteBuf brand = ByteBufAllocator.DEFAULT.heapBuffer(); DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")", brand ); - user.unsafe().sendPacket( new PluginMessage( "MC|Brand", brand.array().clone(), handshakeHandler.isServerForge() ) ); + user.unsafe().sendPacket( new PluginMessage( "MC|Brand", DefinedPacket.readArray( brand ), handshakeHandler.isServerForge() ) ); brand.release(); } else { diff --git a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java index cb9dbaf1..3daab361 100644 --- a/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java +++ b/proxy/src/main/java/net/md_5/bungee/connection/DownstreamBridge.java @@ -235,7 +235,7 @@ public class DownstreamBridge extends PacketHandler brand.release(); brand = ByteBufAllocator.DEFAULT.heapBuffer(); DefinedPacket.writeString( bungee.getName() + " (" + bungee.getVersion() + ")" + " <- " + serverBrand, brand ); - pluginMessage.setData( brand.array().clone() ); + pluginMessage.setData( DefinedPacket.readArray( brand ) ); brand.release(); // changes in the packet are ignored so we need to send it manually con.unsafe().sendPacket( pluginMessage );