Пример #1
0
 public void sendMessageToTeam(Message mes) {
   Player p = getPlayer(mes.getSlotIndex());
   ArrayList<Player> team;
   if (p.getTeam().equals(Team.team1)) team = team1;
   else team = team2;
   for (Iterator it = team.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     // if(player.getSlotIndex()!=request.getSlotIndex())
     if (player.getSlotIndex() != mes.getSlotIndex()) player.getCom().write(mes);
   }
 }
Пример #2
0
 public void sendMessageToAll(Message mes) {
   for (Iterator it = team2.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     // if(player.getSlotIndex()!=request.getSlotIndex())
     if (player.getSlotIndex() != mes.getSlotIndex()) player.getCom().write(mes);
   }
   for (Iterator it = team1.iterator(); it.hasNext(); ) {
     Player player = (Player) it.next();
     // if(player.getSlotIndex()!=request.getSlotIndex())
     if (player.getSlotIndex() != mes.getSlotIndex()) player.getCom().write(mes);
   }
 }