Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void checkForStart(){
- if(!starting) {
- new BukkitRunnable(){
- int seconds = 30;
- boolean before;
- public void run(){
- if(2 <= getPlayers().size()) {
- if(!starting) {
- starting=true;
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 30 seconds..."));
- }
- if (seconds<=0){
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game is now starting!"));
- startGame();
- cancel();
- return;
- } else if (seconds==5){
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 5 seconds.."));
- } else if (seconds==4){
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 4 seconds.."));
- } else if (seconds==3){
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 3 seconds.."));
- } else if (seconds==2){
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 2 seconds.."));
- } else if (seconds==1){
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cThe game will start in 1 second.."));
- }
- seconds--;
- if(!before) before = true;
- } else {
- starting = false;
- cancel();
- if(before) {
- Bukkit.broadcastMessage(ChatUtil.format(ChatUtil.prefixString + " &7» &cNot enough players to start. Countdown cancelled."));
- before = false;
- }
- }
- }
- }.runTaskTimer(Meetup.getInstance(), 0, 20);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment