Пример #1
0
 private static HungerGame insideGame(Location loc) {
   for (HungerGame game : GameManager.INSTANCE.getRawGames()) {
     if (game.getWorlds().size() <= 0 && game.getCuboids().size() <= 0) return null;
     if (game.getWorlds().contains(loc.getWorld())) return game;
     for (Cuboid c : game.getCuboids()) {
       if (c.isLocationWithin(loc)) return game;
     }
   }
   return null;
 }
Пример #2
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));
   }
 }
Пример #3
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));
 }
Пример #4
0
 public GameCountdown(final HungerGame game) {
   this(game, Defaults.Config.DEFAULT_TIME.getInt(game.getSetup()), false);
 }
Пример #5
0
 public GameCountdown(final HungerGame game, boolean isResuming) {
   this(game, Defaults.Config.DEFAULT_TIME.getInt(game.getSetup()), isResuming);
 }