use of org.dragonet.net.packet.minecraft.PEPacket in project Dragonet-Legacy by DragonetMC.
the class ChatMessageTranslator method handleSpecific.
@Override
public PEPacket[] handleSpecific(ChatMessage packet) {
String msg = "";
try {
//String msg = ((ChatMessage) message).text.asPlaintext();
Object json = new JSONParser().parse(packet.text.encode());
if (json instanceof JSONObject) {
msg = this.getTranslator().translateChatMessage((JSONObject) json);
} else {
msg = packet.text.asPlaintext();
}
} catch (ParseException ex) {
return null;
}
//if(json)
ChatPacket pkMessage = new ChatPacket();
pkMessage.source = "";
pkMessage.type = ChatPacket.TextType.RAW;
pkMessage.message = msg;
return new PEPacket[] { pkMessage };
}
use of org.dragonet.net.packet.minecraft.PEPacket in project Dragonet-Legacy by DragonetMC.
the class PENetworkClient method processPacketBuffer.
public void processPacketBuffer(byte[] buffer) {
PEPacket packet = Protocol.decode(buffer);
if (packet == null) {
return;
}
handlePacket(packet);
}
Aggregations