Beispiel #1
0
  /*
   *
   * ################################################
   *
   * 				DISABLE
   *
   * ################################################
   *
   *
   */
  public void disable() {
    disabled = true;
    spawns.clear();
    scoreBoard.reset();

    for (int a = 0; a < activePlayers.size(); a = 0) {
      try {

        Player p = activePlayers.get(a);
        msgmgr.sendMessage(PrefixType.WARNING, "Game disabled!", p);
        playerLeave(p, true);
      } catch (Exception e) {
      }
    }

    for (int a = 0; a < inactivePlayers.size(); a = 0) {
      try {

        Player p = inactivePlayers.remove(a);
        msgmgr.sendMessage(PrefixType.WARNING, "Game disabled!", p);
      } catch (Exception e) {
      }
    }

    clearSpecs();
    queue.clear();

    endGame();
    LobbyManager.getInstance().updateWall(gameID);
    MessageManager.getInstance()
        .broadcastFMessage(PrefixType.INFO, "broadcast.gamedisabled", "arena-" + gameID);
  }
Beispiel #2
0
  /*
   *
   * ################################################
   *
   * 				PLAYER WIN
   *
   * ################################################
   *
   *
   */
  public void playerWin(Player p) {
    if (GameMode.DISABLED == mode) return;
    Player win = activePlayers.get(0);
    // clearInv(p);
    win.teleport(winloc);
    // restoreInv(win);
    scoreBoard.removePlayer(p);
    msgmgr.broadcastFMessage(
        PrefixType.INFO,
        "game.playerwin",
        "arena-" + gameID,
        "victim-" + p.getName(),
        "player-" + win.getName());

    mode = GameMode.FINISHING;
    LobbyManager.getInstance().updateWall(gameID);
    LobbyManager.getInstance().gameEnd(gameID, win);

    clearSpecs();
    win.setHealth(p.getMaxHealth());
    win.setFoodLevel(20);
    win.setFireTicks(0);
    win.setFallDistance(0);

    sm.playerWin(win, gameID, new Date().getTime() - startTime);
    sm.saveGame(
        gameID, win, getActivePlayers() + getInactivePlayers(), new Date().getTime() - startTime);

    activePlayers.clear();
    inactivePlayers.clear();
    spawns.clear();

    loadspawns();
    LobbyManager.getInstance().updateWall(gameID);
    MessageManager.getInstance()
        .broadcastFMessage(PrefixType.INFO, "broadcast.gameend", "arena-" + gameID);

    // Remove all entities in the world
    for (Entity entity : this.arena.getMax().getWorld().getEntities()) {
      if (entity instanceof Player) continue;
      entity.remove();
    }
  }