Update the PluginMessage packet to respect the protocol limit changes in 1.8

This commit is contained in:
Thinkofdeath 2015-07-16 23:07:30 +01:00
parent 81d1c46a0d
commit 6343416c0c

View File

@ -1,5 +1,6 @@
package net.md_5.bungee.protocol.packet;
import com.google.common.base.Preconditions;
import net.md_5.bungee.protocol.DefinedPacket;
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
@ -38,6 +39,8 @@ public class PluginMessage extends DefinedPacket
data = readArrayLegacy( buf );
} else
{
int maxSize = direction == ProtocolConstants.Direction.TO_SERVER ? Short.MAX_VALUE : 0x100000;
Preconditions.checkArgument(buf.readableBytes() < maxSize);
data = new byte[ buf.readableBytes() ];
buf.readBytes( data );
}