コード例 #1
0
 private DarkBotMCSpambot getClosest() {
   double closestDistance = Double.MAX_VALUE;
   DarkBotMCSpambot closestBot = null;
   synchronized (bots) {
     for (DarkBotMCSpambot bot : bots) {
       if (!bot.getBot().hasSpawned()) continue;
       double distance = bot.getBot().getPlayer().getDistanceToSquared(bot.getBot().getPlayer());
       if (distance < closestDistance) {
         distance = closestDistance;
         closestBot = bot;
       }
     }
   }
   return closestBot;
 }