コード例 #1
0
ファイル: Countdown.java プロジェクト: urndel/HungerBarGames
 @Override
 public void run() {
   final Set<Player> tributes = game.getTributes();
   while (time > 0) {
     if (time < 11 || time % 10 == 0) {
       for (Player p : tributes) {
         p.sendMessage(prefix + GREEN + "The game begins in " + time + " seconds!");
       }
     }
     try {
       Thread.sleep(1000);
     } catch (Exception wtf) {
       wtf.printStackTrace();
     }
     time--;
   }
   Bukkit.getServer()
       .broadcastMessage(
           prefix
               + YELLOW
               + "A game has begun in arena "
               + BLUE
               + game.getArena().getName()
               + "!");
   for (Player p : tributes) {
     p.sendMessage(prefix + GREEN + "May the odds be ever in your favor!");
   }
   game.startGame();
 }
コード例 #2
0
ファイル: Countdown.java プロジェクト: urndel/HungerBarGames
 public void prepareWorld() {
   game.getArena().getWorld().setTime(0);
   game.getArena().fillChests();
   for (Entity e : game.getArena().getWorld().getEntities()) {
     if (e instanceof Monster || e instanceof Slime) {
       Bukkit.getPluginManager()
           .callEvent(new EntityDeathEvent((LivingEntity) e, Collections.<ItemStack>emptyList()));
       e.remove();
     }
   }
 }
コード例 #3
0
ファイル: Countdown.java プロジェクト: urndel/HungerBarGames
 public Countdown(Game game) {
   this.game = game;
   game.setStatus(Status.COUNTDOWN);
   prepareWorld();
   prepareTributes();
   new Thread(this).start();
 }
コード例 #4
0
ファイル: Countdown.java プロジェクト: urndel/HungerBarGames
 public void prepareTributes() {
   Collection<Location> spawns = game.getArena().getWarps().getSpawns().values();
   Set<Player> tributes = game.getTributes();
   Iterator<Location> i = spawns.iterator();
   String list = prefix + GREEN + "Tributes: ";
   for (Player p : tributes) {
     list += RED + p.getName() + WHITE + ", ";
     p.teleport(i.next());
     Players.clearInv(p);
     Players.heal(p);
   }
   list = list.substring(0, list.length() - 2);
   for (Player p : tributes) {
     p.sendMessage(prefix + GREEN + "The countdown has begun!");
     p.sendMessage(list);
   }
 }