Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. public class CountdownHandler {
  2.  
  3. public static int lobbytimer = 61;
  4. public static BukkitTask task1;
  5.  
  6.  
  7. public static void firstCountdown() {
  8. task1 = new BukkitRunnable() {
  9.  
  10. @Override
  11. public void run() {
  12. // TODO Auto-generated method stub
  13. if(lobbytimer <= lobbytimer) {
  14. lobbytimer--;
  15. for(Player all : Bukkit.getOnlinePlayers()) {
  16. all.setLevel(lobbytimer);
  17. }
  18. if(Bukkit.getOnlinePlayers().length < 1) {
  19. for(Player all : Bukkit.getOnlinePlayers()) {
  20. all.sendMessage(SG.prefix + "§7Es sind zu wenige §3Spieler §7online!");
  21. }
  22. lobbytimer = 61;
  23. cancel();
  24. }
  25. }
  26. if(lobbytimer == 60) {
  27. setLocations();
  28. }
  29. if(lobbytimer == 60 || lobbytimer == 30 || lobbytimer == 15 || lobbytimer == 10 || lobbytimer == 5) {
  30. for(Player all : Bukkit.getOnlinePlayers()) {
  31. all.sendMessage(SG.prefix + "§7Das Spiel startet in §3" + lobbytimer + " §7Sekunden");
  32. }
  33. }
  34. if(lobbytimer == 0) {
  35.  
  36. int intega = 0;
  37. int inet = intega;
  38. try{
  39. for(intega = inet; intega < Bukkit.getOnlinePlayers().length; intega++) {
  40. Player player = Bukkit.getOnlinePlayers()[intega];
  41. player.teleport(SG.spawnlocation.get(intega));
  42. }
  43. }catch(IndexOutOfBoundsException e) {
  44. for(intega = inet; intega < Bukkit.getOnlinePlayers().length; intega++) {
  45. Player player = Bukkit.getOnlinePlayers()[intega];
  46. player.teleport(SG.spawnlocation.get(intega));
  47. }
  48. }
  49. SG.status = GameStatus.NOMOVE;
  50. noMoveCountdown();
  51. cancel();
  52. }
  53. }
  54. }.runTaskTimer(SG.plugin, 0, 20);
  55. }
  56.  
  57. public static void noMoveCountdown() {
  58. new BukkitRunnable() {
  59. int schutz= 21;
  60. @Override
  61. public void run() {
  62. // TODO Auto-generated method stub
  63. if(schutz<= schutz) {
  64. schutz--;
  65. }
  66. if(schutz== 20 || schutz== 10 || schutz<= 5 && schutz> 0) {
  67. for(Player all : SG.ingame) {
  68. all.sendMessage(SG.prefix + "§7Die Schutzzeit beginnt in §3" + schutz+ " §7Sekunde(n)");
  69. }
  70. }
  71. if(schutz== 0) {
  72. SG.status = GameStatus.SCHUTZ;
  73. schutzCountdown();
  74. cancel();
  75. }
  76. }
  77. }.runTaskTimer(SG.plugin, 0, 20);
  78. }
  79.  
  80. public static void schutzCountdown() {
  81. new BukkitRunnable() {
  82. int schutz = 21;
  83. @Override
  84. public void run() {
  85. // TODO Auto-generated method stub
  86. if(schutz<= schutz) {
  87. schutz--;
  88. }
  89. if(schutz== 20 || schutz== 10 || schutz<= 5 && schutz> 0) {
  90. for(Player all : SG.ingame) {
  91. all.sendMessage(SG.prefix + "§7Die Schutzzeit endet in §3" + schutz+ " §7Sekunde(n)");
  92. }
  93. if(schutz == 6) {
  94. for(Player all : SG.ingame) {
  95. all.sendMessage(SG.prefix + "§7Die Kisten werden in §35 §7Sekunden neu aufgefüllt.");
  96. }
  97. }
  98. if(schutz == 1) {
  99. for(Player all : SG.ingame) {
  100. ChestListener.chest.clear();
  101. all.sendMessage(SG.prefix + "§7Die §3Kisten §7wurden aufgefüllt.");
  102. }
  103. }
  104. }
  105. if(schutz== 0) {
  106. SG.status = GameStatus.INGAME;
  107. cancel();
  108. }
  109. }
  110. }.runTaskTimer(SG.plugin, 0, 20);
  111. }
  112.  
  113.  
  114. public static void setLocations() {
  115. for(String s : SG.plugin.getConfig().getConfigurationSection("Spawn.").getKeys(false)) {
  116. if(SG.plugin.getConfig().getString("Spawn." + s + ".World") != null) {
  117. World w = Bukkit.getWorld(SG.plugin.getConfig().getString("Spawn." + s + ".World"));
  118. double x = SG.plugin.getConfig().getDouble("Spawn." + s + ".X");
  119. double y = SG.plugin.getConfig().getDouble("Spawn." + s + ".Y");
  120. double z = SG.plugin.getConfig().getDouble("Spawn." + s + ".Z");
  121. Location loc = new Location(w, x, y, z);
  122. SG.spawnlocation.add(loc);
  123. }
  124. }
  125. }
  126.  
  127. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement