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); } }
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); } }
public void sendMessageToPlayer(Message mes) { for (Iterator it = team2.iterator(); it.hasNext(); ) { Player player = (Player) it.next(); if (player.getCom().getAccount().getUsername().equals(mes.getReceiver().getUsername())) player.getCom().write(mes); } for (Iterator it = team1.iterator(); it.hasNext(); ) { Player player = (Player) it.next(); // if(player.getSlotIndex()!=request.getSlotIndex()) if (player.getCom().getAccount().getUsername().equals(mes.getReceiver().getUsername())) player.getCom().write(mes); } }