Converted more Collection sorts to internal sorting methods.
This commit is contained in:
parent
8ee1b1da52
commit
c2a90e857f
@ -47,18 +47,18 @@ public class CmdTop extends FCommand {
|
|||||||
|
|
||||||
// TODO: Better way to sort?
|
// TODO: Better way to sort?
|
||||||
if (criteria.equalsIgnoreCase("members")) {
|
if (criteria.equalsIgnoreCase("members")) {
|
||||||
Collections.sort(factionList, new Comparator<Faction>() {
|
factionList.sort(new Comparator<Faction>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Faction f1, Faction f2) {
|
public int compare(Faction f1, Faction f2) {
|
||||||
int f1Size = f1.getFPlayers().size();
|
int f1Size = f1.getFPlayers().size();
|
||||||
int f2Size = f2.getFPlayers().size();
|
int f2Size = f2.getFPlayers().size();
|
||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (criteria.equalsIgnoreCase("start")) {
|
} else if (criteria.equalsIgnoreCase("start")) {
|
||||||
Collections.sort(factionList, new Comparator<Faction>() {
|
Collections.sort(factionList, new Comparator<Faction>() {
|
||||||
@ -104,18 +104,18 @@ public class CmdTop extends FCommand {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (criteria.equalsIgnoreCase("online")) {
|
} else if (criteria.equalsIgnoreCase("online")) {
|
||||||
Collections.sort(factionList, new Comparator<Faction>() {
|
factionList.sort(new Comparator<Faction>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(Faction f1, Faction f2) {
|
public int compare(Faction f1, Faction f2) {
|
||||||
int f1Size = f1.getFPlayersWhereOnline(true).size();
|
int f1Size = f1.getFPlayersWhereOnline(true).size();
|
||||||
int f2Size = f2.getFPlayersWhereOnline(true).size();
|
int f2Size = f2.getFPlayersWhereOnline(true).size();
|
||||||
if (f1Size < f2Size) {
|
if (f1Size < f2Size) {
|
||||||
return 1;
|
return 1;
|
||||||
} else if (f1Size > f2Size) {
|
} else if (f1Size > f2Size) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else if (criteria.equalsIgnoreCase("money") || criteria.equalsIgnoreCase("balance") || criteria.equalsIgnoreCase("bal")) {
|
} else if (criteria.equalsIgnoreCase("money") || criteria.equalsIgnoreCase("balance") || criteria.equalsIgnoreCase("bal")) {
|
||||||
factionList.sort(new Comparator<Faction>() {
|
factionList.sort(new Comparator<Faction>() {
|
||||||
|
Loading…
Reference in New Issue
Block a user