use of org.dragonet.net.packet.minecraft.ChatPacket 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 };
}
Aggregations