示例#1
0
  private void startRound(final int instanceId) {
    if (NexusLoader.detailedDebug) {
      this.print("Event: trying to start new round for instance " + instanceId);
    }
    if (this.getEventData(instanceId).canStartNewRound()) {
      if (NexusLoader.detailedDebug) {
        this.print(
            "Event: starting new round; current round = " + this.getEventData(instanceId)._round);
      }
      this.getEventData(instanceId)._roundActive = true;
      this.getEventData(instanceId)._alivePlayers = this.getPlayers(instanceId).size();
      for (PlayerEventInfo player : this.getPlayers(instanceId)) {
        this.respawnPlayer(player, instanceId);
        if (!this._allowSchemeBuffer) continue;
        EventBuffer.getInstance().buffPlayer(player, true);
      }
      this.getEventData(instanceId).newRound();
      this.getEventData(instanceId).setWaitingState(true);
      this.waitingStateEffects(instanceId, true);
      CallBack.getInstance()
          .getOut()
          .scheduleGeneral(
              new Runnable() {

                @Override
                public void run() {
                  if (LastManStanding.this.getEventData(instanceId)._isActive
                      && ((Deathmatch.DMEventInstance)
                                  LastManStanding.this._matches.get(
                                      (Object) Integer.valueOf((int) instanceId)))
                              ._nextState
                          == Deathmatch.EventState.END) {
                    LastManStanding.this.announce(
                        instanceId,
                        LanguageEngine.getMsg(
                            "lms_roundStarted",
                            LastManStanding.this.getEventData(instanceId)._round));
                    LastManStanding.this.getEventData(instanceId).setWaitingState(false);
                    LastManStanding.this.waitingStateEffects(instanceId, false);
                  }
                }
              },
              this._roundWaitTime * 1000);
      if (NexusLoader.detailedDebug) {
        this.print("Event: new round started!");
      }
    } else {
      if (NexusLoader.detailedDebug) {
        this.print("Event: CAN'T START new round!");
      }
      this.announce(
          instanceId, "Configs are wrong for Last Man Standing event. Event aborted until fixed.");
      NexusLoader.debug(
          (String) "Rounds count config for LMS must be at least 1. Event has been aborted",
          (Level) Level.WARNING);
      this.endInstance(instanceId, true, false, true);
    }
  }
示例#2
0
 @Override
 protected LMSData getEventData(int instance) {
   try {
     return (LMSData)
         ((Deathmatch.DMEventInstance) this._matches.get((Object) Integer.valueOf((int) instance)))
             ._data;
   } catch (Exception e) {
     NexusLoader.debug((String) ("Error on getEventData for instance " + instance));
     e.printStackTrace();
     return null;
   }
 }
示例#3
0
 @Override
 public void onDisconnect(PlayerEventInfo player) {
   if (player.isOnline()) {
     if (NexusLoader.detailedDebug) {
       this.print(
           "AbstractMainEvent: player "
               + player.getPlayersName()
               + " (instance id = "
               + player.getInstanceId()
               + ") disconnecting from the event");
     }
     EventTeam team = player.getEventTeam();
     player.restoreData();
     player.setXYZInvisible(
         player.getOrigLoc().getX(), player.getOrigLoc().getY(), player.getOrigLoc().getZ());
     EventWarnings.getInstance().addPoints(player.getPlayersId(), 1);
     boolean running = false;
     AbstractMainEvent.AbstractEventInstance playersMatch = this.getMatch(player.getInstanceId());
     if (playersMatch == null) {
       NexusLoader.debug(
           (String) "Player's EventInstance is null, called onDisconnect", (Level) Level.WARNING);
       if (NexusLoader.detailedDebug) {
         this.print(
             "AbstractMainEvent: !!! -.- player's EVENT INSTANCE is null after calling onDisconnect. Player's instanceId is = "
                 + player.getInstanceId());
       }
       running = false;
     } else {
       running = playersMatch.isActive();
     }
     team.removePlayer(player);
     this._manager.getPlayers().remove((Object) player);
     CallBack.getInstance().getPlayerBase().playerDisconnected(player);
     if (running) {
       if (NexusLoader.detailedDebug) {
         this.print("AbstractMainEvent: -.- event is active");
       }
       this.debug(
           this.getEventName()
               + ": Player "
               + player.getPlayersName()
               + " disconnected from main event, still enought players to continue the event.");
       if (team.getPlayers().isEmpty()) {
         this.announce(
             player.getInstanceId(),
             LanguageEngine.getMsg("event_disconnect_team", team.getTeamName()));
         this.debug(
             this.getEventName()
                 + ": all players from team "
                 + team.getTeamName()
                 + " have disconnected.");
         if (NexusLoader.detailedDebug) {
           this.print(
               "AbstractMainEvent: ALL PLAYERS FROM TEAM " + team.getTeamName() + " disconnected");
         }
       }
       if (!this.checkIfEventCanContinue(player.getInstanceId(), player)) {
         this.announce(player.getInstanceId(), LanguageEngine.getMsg("event_disconnect_all"));
         this.endInstance(player.getInstanceId(), true, false, false);
         this.debug(
             this.getEventName()
                 + ": no players left in the teams, the fight cannot continue. The event has been aborted!");
         if (NexusLoader.detailedDebug) {
           this.print(
               "AbstractMainEvent: NO PLAYERS LEFT IN THE TEAMS, THE FIGHT CAN'T CONTINUE! (checkIfEventCanContinue = false)");
         }
         return;
       }
       if (this.checkIfAllDied(player.getInstanceId())) {
         this.endRound(player.getInstanceId(), false, false);
       }
     } else if (NexusLoader.detailedDebug) {
       this.print("AbstractMainEvent: -.- event IS NOT active anymore");
     }
   }
 }