use of org.apollo.game.message.impl.PrivateChatMessage in project apollo by apollo-rsps.
the class PrivateChatMessageDecoder method decode.
@Override
public PrivateChatMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
String username = NameUtil.decodeBase37(reader.getSigned(DataType.LONG));
int length = packet.getLength() - Long.BYTES;
byte[] originalCompressed = new byte[length];
reader.getBytes(originalCompressed);
String decompressed = TextUtil.decompress(originalCompressed, length);
decompressed = TextUtil.filterInvalidCharacters(decompressed);
decompressed = TextUtil.capitalize(decompressed);
byte[] recompressed = new byte[length];
TextUtil.compress(decompressed, recompressed);
return new PrivateChatMessage(decompressed, recompressed, username);
}
use of org.apollo.game.message.impl.PrivateChatMessage in project apollo by apollo-rsps.
the class PrivateChatMessageDecoder method decode.
@Override
public PrivateChatMessage decode(GamePacket packet) {
GamePacketReader reader = new GamePacketReader(packet);
String username = NameUtil.decodeBase37(reader.getSigned(DataType.LONG));
int length = packet.getLength() - Long.BYTES;
byte[] originalCompressed = new byte[length];
reader.getBytes(originalCompressed);
String decompressed = TextUtil.decompress(originalCompressed, length);
decompressed = TextUtil.filterInvalidCharacters(decompressed);
decompressed = TextUtil.capitalize(decompressed);
byte[] recompressed = new byte[length];
TextUtil.compress(decompressed, recompressed);
return new PrivateChatMessage(new String(decompressed), recompressed, username);
}
Aggregations