From 853bc53e210ec0071d84d1c39520fdfbab954f82 Mon Sep 17 00:00:00 2001 From: zml2008 Date: Tue, 7 Aug 2012 14:14:40 -0700 Subject: [PATCH] /me is an idiot and forgot that WECUI packets don't have the string length in them (string length == packet length) --- .../java/com/sk89q/worldedit/spout/WorldEditCUICodec.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java b/src/main/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java index b24a4adb4..9404c1f5b 100644 --- a/src/main/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java +++ b/src/main/java/com/sk89q/worldedit/spout/WorldEditCUICodec.java @@ -39,15 +39,14 @@ public class WorldEditCUICodec extends MessageCodec 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);