Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2015
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.53 KB | None | 0 0
  1. package me.nation.timer;
  2.  
  3. import java.util.ArrayList;
  4.  
  5. import me.confuser.barapi.BarAPI;
  6. import me.nation.Main;
  7. import me.nation.habilidades.KangarooPreGame;
  8. import me.nation.managers.Habilidade;
  9. import me.nation.managers.IniciandoEvt;
  10.  
  11. import org.bukkit.Bukkit;
  12. import org.bukkit.ChatColor;
  13. import org.bukkit.Sound;
  14. import org.bukkit.entity.Player;
  15. import org.bukkit.potion.PotionEffect;
  16. import org.bukkit.potion.PotionEffectType;
  17. import org.bukkit.scoreboard.DisplaySlot;
  18. import org.bukkit.scoreboard.Objective;
  19. import org.bukkit.scoreboard.Score;
  20. import org.bukkit.scoreboard.Scoreboard;
  21. import org.bukkit.scoreboard.ScoreboardManager;
  22.  
  23. public class Iniciando {
  24.  
  25. public static ArrayList<String> Jogadores = new ArrayList();
  26. public static Scoreboard getScoreBoard() {
  27. ScoreboardManager manager = Bukkit.getScoreboardManager();
  28. Scoreboard board = manager.getNewScoreboard();
  29. return board;
  30. }
  31. {
  32. public static Integer ReIniciando = Integer.valueOf(180);
  33. public static ArrayList<String> RelogPreGame = new ArrayList<String>();
  34. private static Integer shed_id = null;
  35. public Objective o;
  36. public Iniciando() {
  37. if(Main.PreGame) {
  38. shed_id = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Main.instance, new Runnable() {
  39. public void run() {
  40. if (Main.TimerIniciando > 0) {
  41. if (Main.TimerIniciando >= 30 & Main.TimerIniciando % 30 == 0) {
  42. for (Player pl : Bukkit.getOnlinePlayers()) {
  43. pl.setHealth(20);
  44. pl.setFoodLevel(20);
  45. pl.setExp(0);
  46. pl.setRemainingAir(20);
  47. }
  48. if ((Main.PreGame) && (Main.TimerIniciando == 180)) {
  49. Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "3 Minutos!");
  50. }
  51. if ((Main.PreGame) && (Main.TimerIniciando == 120)) {
  52. Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "2 Minutos!");
  53. }
  54. if ((Main.PreGame) && (Main.TimerIniciando == 60)) {
  55. Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "1 Minuto!");
  56. }
  57. if ((Main.PreGame) && (Main.TimerIniciando == 30)) {
  58. Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "30 Segundos!");
  59. }
  60. if((Main.PreGame) && (Main.TimerIniciando == 10)) {
  61. Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + "10 Segundos!");
  62. }
  63. } if ((Main.PreGame) && (Main.TimerIniciando < 6)) {
  64. Bukkit.broadcastMessage("§c§l!! §7A Partida inicia em " + ChatColor.WHITE + StringTimer.TimerGame(Integer.valueOf(Main.TimerIniciando)));
  65. for(Player pl : Bukkit.getOnlinePlayers()) {
  66. if(Main.Jogadores.contains(pl.getName())) {
  67. pl.setAllowFlight(false);
  68. pl.setFlying(false);
  69. IniciandoEvt.onTeleport();
  70. pl.playSound(pl.getLocation(), Sound.CLICK, 1.0F, (byte) 1);
  71. IniciandoEvt.Teleportar = true;
  72. KangarooPreGame.Kangaroo = false;
  73. RelogPreGame.add(pl.getName());
  74. pl.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 120, 50));
  75. pl.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, 120, 50));
  76. pl.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 120, 1000));
  77. }
  78. }
  79. }
  80. Main.TimerIniciando--;
  81. if(Main.PreGame) {
  82. for (Player p : Bukkit.getOnlinePlayers()) {
  83. String kit = Habilidade.NomeDoKit(Habilidade.getAbility(p));
  84. Scoreboard board = Bukkit.getScoreboardManager().getNewScoreboard();
  85. Objective o = board.registerNewObjective("board", "KawaiiHG");
  86. o.setDisplayName(" §f§lHARDCORE GAMES");
  87. o.setDisplaySlot(DisplaySlot.SIDEBAR);
  88. Score a2 = o.getScore("§c");
  89. a2.setScore(9);
  90. Score a4 = o.getScore("§fPrejogo:");
  91. a4.setScore(8);
  92. Score a5 = o.getScore("§a" + StringTimer.TimerGame(Main.TimerIniciando));
  93. a5.setScore(7);
  94. Score a6 = o.getScore("§6");
  95. a6.setScore(6);
  96. Score a7 = o.getScore("§fKit:");
  97. a7.setScore(5);
  98. Score a8 = o.getScore("§a" + kit);
  99. a8.setScore(4);
  100. Score a16 = o.getScore("§a");
  101. a16.setScore(3);
  102. Score a12 = o.getScore("§fIp:§a 01");
  103. a12.setScore(2);
  104. Score a13 = o.getScore("§eOnline " + Main.Jogadores.size() + "/" + Bukkit.getServer().getMaxPlayers());
  105. a13.setScore(1);
  106. p.setScoreboard(board);
  107. }
  108. }
  109. } else if ((Main.PreGame) && (Main.Jogadores.size() < Main.MinimoJogadores.intValue())) {
  110. Main.TimerIniciando = ReIniciando.intValue();
  111. Bukkit.broadcastMessage("§b§l!! §7§7Contagem reiniciada aguardando §b5§7 jogadores.");
  112. IniciandoEvt.Teleportar = false;
  113. KangarooPreGame.Kangaroo = true;
  114. for (Player pl : Bukkit.getOnlinePlayers()) {
  115. if(Main.Jogadores.contains(pl.getName())) {
  116. for (PotionEffect effect : pl.getActivePotionEffects()) {
  117. pl.removePotionEffect(effect.getType());
  118. }
  119. }
  120. }
  121. } else {
  122. Main.IniciarPartida();
  123. }
  124. }
  125. }, 0, 20);
  126. }
  127. }
  128. public static void cancel() {
  129. if(shed_id != null) {
  130. Bukkit.getServer().getScheduler().cancelTask(shed_id);
  131. shed_id = null;
  132. }
  133. }
  134. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement