Search in sources :

Example 1 with StartTask

use of net.warvale.core.tasks.StartTask in project GameCore by Warvale.

the class Initialization method startGame.

public void startGame() {
    new Bosses().initBoss();
    List<Player> players = new ArrayList<>();
    List<Player> red = new ArrayList<>();
    List<Player> blue = new ArrayList<>();
    Main.getTeams().getBlueTeam().getPlayers().stream().filter(OfflinePlayer::isOnline).forEach(offlinePlayer -> {
        players.add(offlinePlayer.getPlayer());
        blue.add(offlinePlayer.getPlayer());
    });
    Main.getTeams().getRedTeam().getPlayers().stream().filter(OfflinePlayer::isOnline).forEach(offlinePlayer -> {
        players.add(offlinePlayer.getPlayer());
        red.add(offlinePlayer.getPlayer());
    });
    players.forEach(player -> {
        player.addPotionEffects(Arrays.asList(new PotionEffect(PotionEffectType.SLOW, 100000, 128, false), new PotionEffect(PotionEffectType.JUMP, 100000, 250, false)));
        String team = player.getScoreboard().getTeam(player.getName()).getName();
        player.sendMessage((String[]) Arrays.asList("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", ChatUtils.divider, "You are on team " + (team.equals("blue") ? ChatUtils.blue + "blue!" : ChatUtils.red + "red!"), "\n", ChatUtils.gray + "Your goal is to destroy the other teams " + ChatUtils.yellow + "core" + ChatUtils.gray + " 20 times!", "The game is divided into " + ChatUtils.red + "5" + ChatUtils.gray + " stages!", ChatUtils.yellow + "1." + ChatUtils.gray + " During the first " + ChatUtils.red + "20" + ChatUtils.gray + " minutes of the game, your core is invulnerable!", ChatUtils.yellow + "2." + ChatUtils.gray + " At the end of the first stage, a boss spawns in the middle of the map!", ChatUtils.yellow + "3." + ChatUtils.gray + " After that, diamonds will start to appear at middle. Diamonds can be used to craft the strongest armor in the game!", ChatUtils.yellow + "4." + ChatUtils.yellow + " Siege mode!" + ChatUtils.gray + " During this stage of the game, core breaking is 2x as powerful1!", ChatUtils.yellow + "5." + ChatUtils.gray + " During the last stage of the game, cores will be broken instantly!", ChatUtils.divider).toArray());
        new StartTask(this.map).runTaskTimer(Main.get(), 0, 20);
    });
}
Also used : StartTask(net.warvale.core.tasks.StartTask) Player(org.bukkit.entity.Player) OfflinePlayer(org.bukkit.OfflinePlayer) PotionEffect(org.bukkit.potion.PotionEffect) ArrayList(java.util.ArrayList) Bosses(net.warvale.core.game.start.Bosses)

Example 2 with StartTask

use of net.warvale.core.tasks.StartTask in project GameCore by Warvale.

the class GameStart method startCountdown.

public static void startCountdown() {
    //runs when there is at least one player on each team (change in TeamSelect lines 113 and 133)
    map = null;
    mapNumbers.put(1, "Redwood Forest");
    mapNumbers.put(2, "Volcano Island");
    mapNumbers.put(3, "Pagoda Everglade");
    mapNumbers.put(4, "Extraterrestrial");
    votes.put("redwood_forest", 0);
    votes.put("volcano_island", 0);
    votes.put("pagoda_everglade", 0);
    votes.put("extraterrestrial", 0);
    new Game().setState(State.COUNTDOWN);
    initActive = true;
    for (Player player : Bukkit.getServer().getOnlinePlayers()) {
        if (player.isOp()) {
            player.sendMessage(ChatColor.DARK_RED + "[STAFF]" + ChatColor.WHITE + " The game is starting!");
        }
    }
    votingActive = true;
    voted.clear();
    //Get team players
    for (String player : Main.getTeams().getBlueTeam().getEntries()) {
        teamBlue.add(Bukkit.getPlayer(player));
    }
    for (String player : Main.getTeams().getRedTeam().getEntries()) {
        teamRed.add(Bukkit.getPlayer(player));
    }
    //send voting message
    for (int i = 0; i < teamBlue.size(); i++) {
        Player p = teamBlue.get(i);
        p.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD + "/vote #" + ChatColor.BLUE.toString() + ChatColor.BOLD + " to vote for a map!" + ChatColor.DARK_BLUE + "\n1: Redwood Forest" + "\n2: Volcano Island" + "\n3: Pagoda Everglade" + "\n4: Extraterrestrial");
    }
    for (int i = 0; i < teamRed.size(); i++) {
        Player p = teamRed.get(i);
        p.sendMessage(ChatColor.RED.toString() + ChatColor.BOLD + "/vote #" + ChatColor.BLUE.toString() + ChatColor.BOLD + " to vote for a map!" + ChatColor.DARK_BLUE + "\n1: Redwood Forest" + "\n2: Volcano Island" + "\n3: Pagoda Everglade" + "\n4: Extraterrestrial");
    }
    new StartTask(map).run();
}
Also used : StartTask(net.warvale.core.tasks.StartTask) Player(org.bukkit.entity.Player) Game(net.warvale.core.game.Game)

Aggregations

StartTask (net.warvale.core.tasks.StartTask)2 Player (org.bukkit.entity.Player)2 ArrayList (java.util.ArrayList)1 Game (net.warvale.core.game.Game)1 Bosses (net.warvale.core.game.start.Bosses)1 OfflinePlayer (org.bukkit.OfflinePlayer)1 PotionEffect (org.bukkit.potion.PotionEffect)1