/me is an idiot and forgot that WECUI packets don't have the string length in them (string length == packet length)

This commit is contained in:
zml2008 2012-08-07 14:14:40 -07:00
parent fe445a7ec9
commit 853bc53e21

View File

@ -39,15 +39,14 @@ public class WorldEditCUICodec extends MessageCodec<WorldEditCUIMessage> impleme
public ChannelBuffer encode(WorldEditCUIMessage message) {
byte[] data = message.getMessage().getBytes(UTF_8_CHARSET);
ChannelBuffer buffer = ChannelBuffers.buffer(data.length + 2);
buffer.writeShort(data.length);
ChannelBuffer buffer = ChannelBuffers.buffer(data.length);
buffer.writeBytes(data);
return buffer;
}
@Override
public WorldEditCUIMessage decode(ChannelBuffer buffer) {
byte[] data = new byte[buffer.readShort()];
byte[] data = new byte[buffer.readableBytes()];
buffer.readBytes(data);
String message = new String(data, UTF_8_CHARSET);
return new WorldEditCUIMessage(message);