use of io.xol.chunkstories.content.translator.IncompatibleContentException in project chunkstories by Hugobros3.
the class PacketContentTranslator method process.
@Override
public void process(PacketSender sender, DataInputStream in, PacketReceptionContext context) throws IOException, PacketProcessingException {
this.serializedText = in.readUTF();
ByteArrayInputStream bais = new ByteArrayInputStream(serializedText.getBytes("UTF-8"));
BufferedReader reader = new BufferedReader(new InputStreamReader(bais, "UTF-8"));
try {
OnlineContentTranslator translator = new LoadedContentTranslator(context.getContext().getContent(), reader);
PacketsContextCommon cCommon = (PacketsContextCommon) context;
cCommon.setContentTranslator(translator);
context.logger().info("Successfully installed content translator");
cCommon.getConnection().handleSystemRequest("world/translator_ok");
} catch (IncompatibleContentException e) {
e.printStackTrace();
}
reader.close();
}
Aggregations