public List<Resident> getOnlineResidents(ResidentList residentList) { List<Resident> onlineResidents = new ArrayList<Resident>(); for (Player player : plugin.getServer().getOnlinePlayers()) { for (Resident resident : residentList.getResidents()) { if (resident.getName().equalsIgnoreCase(player.getName())) onlineResidents.add(resident); } } return onlineResidents; }
public boolean isActiveResident(Resident resident) { return ((System.currentTimeMillis() - resident.getLastOnline() < (20 * TownySettings.getInactiveAfter())) || (plugin.isOnline(resident.getName()))); }
public static Player getPlayer(Resident resident) throws TownyException { for (Player player : getOnlinePlayers()) if (player.getName().equals(resident.getName())) return player; throw new TownyException(String.format("%s is not online", resident.getName())); }