Example #1
0
  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;
  }
Example #2
0
 public boolean isActiveResident(Resident resident) {
   return ((System.currentTimeMillis() - resident.getLastOnline()
           < (20 * TownySettings.getInactiveAfter()))
       || (plugin.isOnline(resident.getName())));
 }
Example #3
0
 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()));
 }