Advertisement
Guest User

Untitled

a guest
Apr 26th, 2015
202
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. List<Town> townsToCheck = TownyUniverse.getDataSource().getTowns();
  2. List<Town> townsToCount = TownyUniverse.getDataSource().getTowns();
  3. Integer topResidents = 0;
  4. while (townsToCount.size() > 0) {
  5. for (Town town: townsToCount) {
  6. if (town.getNumResidents() >= topResidents) {
  7. topResidents = town.getNumResidents();
  8. }
  9. }
  10. //player.sendMessage(topresidents.toString());
  11. for (Town town: townsToCheck) {
  12. //player.sendMessage(town.getName());
  13. if (town.getNumResidents() >= topResidents) {
  14. townsToCheck.remove(town);
  15. townsToCount.remove(town);
  16. String output = Colors.LightBlue + town.getName() + Colors.Gray + " - " + Colors.Blue + "(" + town.getNumResidents() + ")";
  17. if (town.isOpen())
  18. output += Colors.White + " (Open)";
  19. //formatedList.add(output);
  20. player.sendMessage(output);
  21. player.sendMessage("Remaining Towns: " + townsToCount.size());
  22. }
  23. }
  24. topResidents = 0;
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement