Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-09 21:10:05 +01:00
/me is an idiot and forgot that WECUI packets don't have the string length in them (string length == packet length)
Dieser Commit ist enthalten in:
Ursprung
fe445a7ec9
Commit
853bc53e21
@ -39,15 +39,14 @@ public class WorldEditCUICodec extends MessageCodec<WorldEditCUIMessage> impleme
|
|||||||
public ChannelBuffer encode(WorldEditCUIMessage message) {
|
public ChannelBuffer encode(WorldEditCUIMessage message) {
|
||||||
byte[] data = message.getMessage().getBytes(UTF_8_CHARSET);
|
byte[] data = message.getMessage().getBytes(UTF_8_CHARSET);
|
||||||
|
|
||||||
ChannelBuffer buffer = ChannelBuffers.buffer(data.length + 2);
|
ChannelBuffer buffer = ChannelBuffers.buffer(data.length);
|
||||||
buffer.writeShort(data.length);
|
|
||||||
buffer.writeBytes(data);
|
buffer.writeBytes(data);
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WorldEditCUIMessage decode(ChannelBuffer buffer) {
|
public WorldEditCUIMessage decode(ChannelBuffer buffer) {
|
||||||
byte[] data = new byte[buffer.readShort()];
|
byte[] data = new byte[buffer.readableBytes()];
|
||||||
buffer.readBytes(data);
|
buffer.readBytes(data);
|
||||||
String message = new String(data, UTF_8_CHARSET);
|
String message = new String(data, UTF_8_CHARSET);
|
||||||
return new WorldEditCUIMessage(message);
|
return new WorldEditCUIMessage(message);
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren