/** * checks to see if client is banned from the room called before client joins a room * * <p>Also cleans BanList of expired bans if found * * @param roomName the room to check * @return true is banned false if not */ public Boolean isBanned(String roomName) { Boolean isBanned = false; Iterator<Ban> iter = banList.iterator(); Ban ban; while (iter.hasNext()) { ban = iter.next(); if (ban.getRoomName().equals(roomName)) { // if there is a ban on the room to join set isBanned to the value of that ban isBanned = ban.isBanned(); } // if an expired ban is found remove from banList if (ban.isBanned() == false) { iter.remove(); } } return isBanned; }
@Override public void run() { // after ban duration set ban to false ban.setIsBanned(false); }