rjng

Untitled

Jan 22nd, 2017
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.37 KB | None | 0 0
  1. public void checkForStart(){
  2. if(!starting) {
  3. new BukkitRunnable(){
  4. int seconds = 30;
  5.  
  6. boolean before;
  7.  
  8. public void run(){
  9. if(2 <= getPlayers().size()) {
  10. if(!starting) {
  11. starting=true;
  12. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 30 seconds..."));
  13. }
  14. if (seconds<=0){
  15. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game is now starting!"));
  16. startGame();
  17. cancel();
  18. return;
  19. } else if (seconds==5){
  20. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 5 seconds.."));
  21. } else if (seconds==4){
  22. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 4 seconds.."));
  23. } else if (seconds==3){
  24. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 3 seconds.."));
  25. } else if (seconds==2){
  26. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 2 seconds.."));
  27. } else if (seconds==1){
  28. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 1 second.."));
  29. }
  30. seconds--;
  31.  
  32. if(!before) before = true;
  33. } else {
  34. starting = false;
  35. cancel();
  36. if(before) {
  37. Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cNot enough players to start. Countdown cancelled."));
  38. before = false;
  39. }
  40. }
  41. }
  42. }.runTaskTimer(Meetup.getInstance(), 0, 20);
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment