/** IMPORTANT: Call this from the onMessage method in the subclass. */
public IMessage processMessage(final ObservationRequestMessage message, final MessageContext ctx)
{
IThreadListener mainThread = (WorldServer)ctx.getServerHandler().playerEntity.worldObj;
mainThread.addScheduledTask(new Runnable() {
@Override
public void run() {
EntityPlayerMP player = ctx.getServerHandler().playerEntity;
JsonObject json = new JsonObject();
buildJson(json, player, message, ctx);
// Send this message back again now we've filled in the json stats.
Map<String, String> returnData = new HashMap<String, String>();
returnData.put("json", json.toString());
message.addReturnData(returnData);
MalmoMod.network.sendTo(new MalmoMod.MalmoMessage(MalmoMessageType.SERVER_OBSERVATIONSREADY, message.id, returnData), player);
}
});
return null; // no response in this case
}
ObservationFromServer.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:Proyecto-DASI
作者:
评论列表
文章目录