示例#1
0
 private void announce(long time) {
   if (time >= 3600 && time % 3600 == 0) {
     if (TvTEvent.isParticipating()) {
       Announcements.getInstance()
           .announceToAll(
               "TvT Event: " + (time / 60 / 60) + " hour(s) until registration is closed!");
     } else if (TvTEvent.isStarted()) {
       TvTEvent.sysMsgToAllParticipants(
           "TvT Event: " + (time / 60 / 60) + " hour(s) until event is finished!");
     }
   } else if (time >= 60) {
     if (TvTEvent.isParticipating()) {
       Announcements.getInstance()
           .announceToAll(
               "TvT Event: " + (time / 60) + " minute(s) until registration is closed!");
     } else if (TvTEvent.isStarted()) {
       TvTEvent.sysMsgToAllParticipants(
           "TvT Event: " + (time / 60) + " minute(s) until the event is finished!");
     }
   } else {
     if (TvTEvent.isParticipating()) {
       Announcements.getInstance()
           .announceToAll("TvT Event: " + time + " second(s) until registration is closed!");
     } else if (TvTEvent.isStarted()) {
       TvTEvent.sysMsgToAllParticipants(
           "TvT Event: " + time + " second(s) until the event is finished!");
     }
   }
 }
示例#2
0
  /** Method to start participation */
  public void startReg() {
    if (!TvTEvent.startParticipation()) {
      Announcements.getInstance().announceToAll("TvT Event: Event was cancelled.");
      _log.warning("TvTEventEngine[TvTManager.run()]: Error spawning event npc for participation.");

      this.scheduleEventStart();
    } else {
      Announcements.getInstance()
          .announceToAll(
              "TvT Event: Registration opened for "
                  + Config.TVT_EVENT_PARTICIPATION_TIME
                  + " minute(s).");

      // schedule registration end
      _task.setStartTime(System.currentTimeMillis() + 60000L * Config.TVT_EVENT_PARTICIPATION_TIME);
      ThreadPoolManager.getInstance().executeTask(_task);
    }
  }
示例#3
0
  /** Method to end the event and reward */
  public void endEvent() {
    Announcements.getInstance().announceToAll(TvTEvent.calculateRewards());
    TvTEvent.sysMsgToAllParticipants(
        "TvT Event: Teleporting back to the registration npc in "
            + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY
            + " second(s).");
    TvTEvent.stopFight();

    this.scheduleEventStart();
  }
示例#4
0
  /** Method to start the fight */
  public void startEvent() {
    if (!TvTEvent.startFight()) {
      Announcements.getInstance()
          .announceToAll("TvT Event: Event cancelled due to lack of Participation.");
      _log.info("TvTEventEngine[TvTManager.run()]: Lack of registration, abort event.");

      this.scheduleEventStart();
    } else {
      TvTEvent.sysMsgToAllParticipants(
          "TvT Event: Teleporting participants to an arena in "
              + Config.TVT_EVENT_START_LEAVE_TELEPORT_DELAY
              + " second(s).");
      _task.setStartTime(System.currentTimeMillis() + 60000L * Config.TVT_EVENT_RUNNING_TIME);
      ThreadPoolManager.getInstance().executeTask(_task);
    }
  }