예제 #1
0
 public GameCountdown(final HungerGame game, int num, boolean isResuming) {
   this.game = game;
   countdown = num;
   task =
       Bukkit.getScheduler().runTaskTimer(HungerGames.getInstance(), this, 20L, 20L).getTaskId();
   this.isResuming = isResuming;
   if (isResuming) {
     ChatUtils.broadcast(
         game, "Resuming %s in %s...", game.getName(), GeneralUtils.formatTime(countdown));
   } else {
     ChatUtils.broadcast(
         game, "Starting %s in %s...", game.getName(), GeneralUtils.formatTime(countdown));
   }
 }
예제 #2
0
 public void run() {
   if (countdown <= 1) {
     cancel();
     game.setDoneCounting();
     if (isResuming) {
       game.resumeGame(starter, 0);
     } else {
       game.startGame(starter, 0);
     }
     return;
   }
   countdown--;
   ChatColor color = ChatColor.GREEN;
   if (countdown <= 5) color = ChatColor.GOLD;
   if (countdown <= 3) color = ChatColor.RED;
   ChatUtils.broadcastRaw(game, color, "%s...", GeneralUtils.formatTime(countdown));
 }