From afde3e188b180f24b6b14d25aeefcd7774548e7b Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Sat, 5 Mar 2011 10:53:08 +0100 Subject: [PATCH] Type safety and warning fix. --- src/com/bukkit/mcteam/factions/Commands.java | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/src/com/bukkit/mcteam/factions/Commands.java b/src/com/bukkit/mcteam/factions/Commands.java index 9022da0a..a19da262 100644 --- a/src/com/bukkit/mcteam/factions/Commands.java +++ b/src/com/bukkit/mcteam/factions/Commands.java @@ -361,12 +361,13 @@ public class Commands { } page -= 1; + + // TODO Doesn't the second sort bellow completely overwrite the first?? + // Sort by total followers first - Collections.sort(FactionList, new Comparator(){ + Collections.sort(FactionList, new Comparator(){ @Override - public int compare(Object o1, Object o2) { - Faction f1 = (Faction) o1; - Faction f2 = (Faction) o2; + public int compare(Faction f1, Faction f2) { if (f1.id == 0) return 1; else if (f2.id == 0) @@ -380,11 +381,9 @@ public class Commands { }); // Then sort by how many members are online now - Collections.sort(FactionList, new Comparator(){ + Collections.sort(FactionList, new Comparator(){ @Override - public int compare(Object o1, Object o2) { - Faction f1 = (Faction) o1; - Faction f2 = (Faction) o2; + public int compare(Faction f1, Faction f2) { if (f1.getFollowersWhereOnline(true).size() < f2.getFollowersWhereOnline(true).size()) return 1; else if (f1.getFollowersWhereOnline(true).size() > f2.getFollowersWhereOnline(true).size())