Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package me.nation.timer;
- import java.util.ArrayList;
- import me.confuser.barapi.BarAPI;
- import me.nation.Main;
- import me.nation.habilidades.KangarooPreGame;
- import me.nation.managers.Habilidade;
- import me.nation.managers.IniciandoEvt;
- import org.bukkit.Bukkit;
- import org.bukkit.ChatColor;
- import org.bukkit.Sound;
- import org.bukkit.entity.Player;
- import org.bukkit.potion.PotionEffect;
- import org.bukkit.potion.PotionEffectType;
- import org.bukkit.scoreboard.DisplaySlot;
- import org.bukkit.scoreboard.Objective;
- import org.bukkit.scoreboard.Score;
- import org.bukkit.scoreboard.Scoreboard;
- import org.bukkit.scoreboard.ScoreboardManager;
- public class Iniciando {
- public static ArrayList<String> Jogadores = new ArrayList();
- public static Scoreboard getScoreBoard() {
- ScoreboardManager manager = Bukkit.getScoreboardManager();
- Scoreboard board = manager.getNewScoreboard();
- return board;
- }
- {
- public static Integer ReIniciando = Integer.valueOf(180);
- public static ArrayList<String> RelogPreGame = new ArrayList<String>();
- private static Integer shed_id = null;
- public Objective o;
- public Iniciando() {
- if(Main.PreGame) {
- shed_id = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Main.instance, new Runnable() {
- public void run() {
- if (Main.TimerIniciando > 0) {
- if (Main.TimerIniciando >= 30 & Main.TimerIniciando % 30 == 0) {
- for (Player pl : Bukkit.getOnlinePlayers()) {
- pl.setHealth(20);
- pl.setFoodLevel(20);
- pl.setExp(0);
- pl.setRemainingAir(20);
- }
- if ((Main.PreGame) && (Main.TimerIniciando == 180)) {
- Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "3 Minutos!");
- }
- if ((Main.PreGame) && (Main.TimerIniciando == 120)) {
- Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "2 Minutos!");
- }
- if ((Main.PreGame) && (Main.TimerIniciando == 60)) {
- Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "1 Minuto!");
- }
- if ((Main.PreGame) && (Main.TimerIniciando == 30)) {
- Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "30 Segundos!");
- }
- if((Main.PreGame) && (Main.TimerIniciando == 10)) {
- Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "10 Segundos!");
- }
- } if ((Main.PreGame) && (Main.TimerIniciando < 6)) {
- Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + StringTimer.TimerGame(Integer.valueOf(Main.TimerIniciando)));
- for(Player pl : Bukkit.getOnlinePlayers()) {
- if(Main.Jogadores.contains(pl.getName())) {
- pl.setAllowFlight(false);
- pl.setFlying(false);
- IniciandoEvt.onTeleport();
- pl.playSound(pl.getLocation(), Sound.CLICK, 1.0F, (byte) 1);
- IniciandoEvt.Teleportar = true;
- KangarooPreGame.Kangaroo = false;
- RelogPreGame.add(pl.getName());
- pl.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 120, 50));
- pl.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 120, 50));
- pl.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 120, 1000));
- }
- }
- }
- Main.TimerIniciando--;
- if(Main.PreGame) {
- for (Player p : Bukkit.getOnlinePlayers()) {
- String kit = Habilidade.NomeDoKit(Habilidade.getAbility(p));
- Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
- Objective o = board.registerNewObjective("board", "KawaiiHG");
- o.setDisplayName(" §f§lHARDCORE GAMES");
- o.setDisplaySlot(DisplaySlot.SIDEBAR);
- Score a2 = o.getScore("§c");
- a2.setScore(9);
- Score a4 = o.getScore("§fPrejogo:");
- a4.setScore(8);
- Score a5 = o.getScore("§a" + StringTimer.TimerGame(Main.TimerIniciando));
- a5.setScore(7);
- Score a6 = o.getScore("§6");
- a6.setScore(6);
- Score a7 = o.getScore("§fKit:");
- a7.setScore(5);
- Score a8 = o.getScore("§a" + kit);
- a8.setScore(4);
- Score a16 = o.getScore("§a");
- a16.setScore(3);
- Score a12 = o.getScore("§fIp:§a 01");
- a12.setScore(2);
- Score a13 = o.getScore("§eOnline " + Main.Jogadores.size() + "/" + Bukkit.getServer().getMaxPlayers());
- a13.setScore(1);
- p.setScoreboard(board);
- }
- }
- } else if ((Main.PreGame) && (Main.Jogadores.size() < Main.MinimoJogadores.intValue())) {
- Main.TimerIniciando = ReIniciando.intValue();
- Bukkit.broadcastMessage("§b§l!! §7§7Contagem reiniciada aguardando §b5§7 jogadores.");
- IniciandoEvt.Teleportar = false;
- KangarooPreGame.Kangaroo = true;
- for (Player pl : Bukkit.getOnlinePlayers()) {
- if(Main.Jogadores.contains(pl.getName())) {
- for (PotionEffect effect : pl.getActivePotionEffects()) {
- pl.removePotionEffect(effect.getType());
- }
- }
- }
- } else {
- Main.IniciarPartida();
- }
- }
- }, 0, 20);
- }
- }
- public static void cancel() {
- if(shed_id != null) {
- Bukkit.getServer().getScheduler().cancelTask(shed_id);
- shed_id = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement