Exemplo n.º 1
0
  public void startGame() {
    state = State.IN_GAME;

    for (Tribute t : ServerGames.tributes) {
      t.player.setHealth(20);
      t.player.setFoodLevel(20);
      clearItems(t.player);
      if (!t.player.isOnline()) {
        ServerGames.tributes.remove(t);
      }
    }

    loaded.clear();
    Chests.resetChests();

    bets.clear();

    clearAll();
    load();

    for (Player p : getCorn().getWorld().getPlayers()) {
      p.setCompassTarget(getCorn());
    }

    server.broadcastMessage(GOLD + "[ServerGames]" + GREEN + " Let the game begin!");

    game = new Game(this);

    startTimer();
  }
Exemplo n.º 2
0
  public void startLobby() {
    server.broadcastMessage(GOLD + "[ServerGames]" + GREEN + " Countdown started.");

    clearAll();

    bets.clear();
    this.clearEnt();
    load();
    tpAll(waiting);
    ServerGames.current = worlds.get(new Random().nextInt(ServerGames.worlds.size()));

    for (Player p : server.getOnlinePlayers()) {
      showAllFor(p);
      showPlayer(p);

      if (isTribute(p) || isSpectator(p)) clearItems(p);
    }

    loaded.clear();

    this.resetPlayers();

    state = State.LOBBY;
    game = new Lobby(this);

    startTimer();
  }
Exemplo n.º 3
0
  public void startDeath() {
    server.broadcastMessage(GOLD + "[ServerGames] " + RED + "Do not run from the deathmatch.");
    for (Tribute t : ServerGames.tributes) {
      if (!t.player.isDead()) {
        t.player.teleport(toCenter(t.start));
        tell(t.player, GOLD + "[ServerGames] " + GREEN + "You have made it to the deathmatch.");
      }
    }

    for (Spectator s : ServerGames.spectators) {
      if (!s.player.isDead()) s.player.teleport(ServerGames.getCorn());
    }

    clearAll();
    load();

    state = State.DEATHMATCH;
    game = new Deathmatch(this);

    startTimer();
  }
Exemplo n.º 4
0
  public void startSetup() {
    clearAll();

    int i = 0;

    for (Player p : server.getOnlinePlayers()) {
      if (!isSpectator(p) && !isTribute(p)) {
        hidePlayer(p);
      }

      if (isTribute(p)) {
        if (i >= getTubes().size()) i = 0;

        Location to = getTubes().get(i);
        p.setHealth(20);
        p.setFoodLevel(20);
        p.setSprinting(false);
        p.setSneaking(false);
        p.setPassenger(null);
        p.setGameMode(GameMode.SURVIVAL);
        p.setFireTicks(0);
        clearItems(p);
        getTribute(p).start = to;
        p.teleport(toCenter(to));

        i++;
      }
    }

    for (String s : ServerGames.worlds) {
      World w = ServerGames.server.getWorld(s);
      w.getEntities().clear();
      w.setThundering(false);
      w.setTime(0);
      w.setWeatherDuration(0);
      w.setStorm(false);
    }

    // ----- WORLD RESETTING -----
    LogBlock logblock = (LogBlock) getServer().getPluginManager().getPlugin("LogBlock");
    QueryParams params = new QueryParams(logblock);

    params.world = getCorn().getWorld();
    params.silent = false;

    try {
      logblock.getCommandsHandler()
      .new CommandRollback(this.getServer().getConsoleSender(), params, false);
    } catch (Exception e) {
    }

    clearEnt();

    // ----- WORLD RESETTING -----

    server.broadcastMessage(DARK_AQUA + "This plugin was created by Brenhien and NerdsWBNerds.");
    server.broadcastMessage(
        DARK_AQUA
            + "Email [email protected] or tweet us (@NerdsWBNerds) with ideas or bugs you have found.");

    load();

    state = State.SET_UP;
    game = new Setup(this);

    startTimer();
  }