Exemplo n.º 1
0
  private void updateModel(ThreadContext ctx)
      throws HttpException, IOException, XmlException, WdbcException, ParseException {
    Model model = ctx.getModel();
    Farm mainFarm = model.getFarms().get(0);
    Status status = new Status();

    status.setName("court");
    status.setDirty(true);
    mainFarm.getHandlerStatuses().put(status.getName(), status);
  }
Exemplo n.º 2
0
  @Override
  protected List<BuildItem> getBuildItems(ThreadContext ctx) {
    String villageName = ctx.getGame().getVillage().getName();
    List<BuildItem> buildItems = m_buildItemMap.get(villageName);

    if (buildItems == null) {
      return Collections.emptyList();
    } else {
      return buildItems;
    }
  }
Exemplo n.º 3
0
  private void startCourt(ThreadContext ctx) throws HttpException, IOException {
    Session session = ctx.getSession();

    ThreadHelper.setRandom(ctx);

    try {
      ThreadHelper.executeRequest(session, m_stateCourtRequest, true);
      m_logger.info("овдирямЙЁи");
    } catch (ThreadException e) {
      // ignore it
    }
  }
Exemplo n.º 4
0
  public void handle(ThreadContext ctx) throws ThreadException {
    Court court = ctx.getModel().getCourt();

    if (court != null && court.isEligible()) {
      try {
        startCourt(ctx);
        updateModel(ctx);
      } catch (Exception e) {
        m_logger.warn("Error when handling Court.", e);
      }
    }
  }