Adds Faction founding date
..but does not implement it. Future commit will need to add this to /f show.
This commit is contained in:
@@ -58,6 +58,21 @@ public class CmdTop extends FCommand {
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
} else if (criteria.equalsIgnoreCase("start")) {
|
||||
Collections.sort(factionList, new Comparator<Faction>() {
|
||||
@Override
|
||||
public int compare(Faction f1, Faction f2) {
|
||||
long f1start = f1.getFoundedDate();
|
||||
long f2start = f2.getFoundedDate();
|
||||
// flip signs because a smaller date is farther in the past
|
||||
if (f1start > f2start) {
|
||||
return 1;
|
||||
} else if (f1start < f2start) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
});
|
||||
} else if (criteria.equalsIgnoreCase("power")) {
|
||||
Collections.sort(factionList, new Comparator<Faction>() {
|
||||
@Override
|
||||
@@ -106,11 +121,11 @@ public class CmdTop extends FCommand {
|
||||
public int compare(Faction f1, Faction f2) {
|
||||
double f1Size = Econ.getBalance(f1.getAccountId());
|
||||
// Lets get the balance of /all/ the players in the Faction.
|
||||
for(FPlayer fp : f1.getFPlayers()) {
|
||||
for (FPlayer fp : f1.getFPlayers()) {
|
||||
f1Size = f1Size + Econ.getBalance(fp.getAccountId());
|
||||
}
|
||||
double f2Size = Econ.getBalance(f2.getAccountId());
|
||||
for(FPlayer fp : f2.getFPlayers()) {
|
||||
for (FPlayer fp : f2.getFPlayers()) {
|
||||
f2Size = f2Size + Econ.getBalance(fp.getAccountId());
|
||||
}
|
||||
if (f1Size < f2Size) {
|
||||
@@ -162,11 +177,13 @@ public class CmdTop extends FCommand {
|
||||
return String.valueOf(faction.getFPlayers().size());
|
||||
} else if (criteria.equalsIgnoreCase("land")) {
|
||||
return String.valueOf(faction.getLandRounded());
|
||||
} else if (criteria.equalsIgnoreCase("start")) {
|
||||
return sdf.format(faction.getFoundedDate());
|
||||
} else if (criteria.equalsIgnoreCase("power")) {
|
||||
return String.valueOf(faction.getPowerRounded());
|
||||
} else { // Last one is balance, and it has 3 different things it could be.
|
||||
double balance = Econ.getBalance(faction.getAccountId());
|
||||
for(FPlayer fp : faction.getFPlayers()) {
|
||||
for (FPlayer fp : faction.getFPlayers()) {
|
||||
balance = balance + Econ.getBalance(fp.getAccountId());
|
||||
}
|
||||
return String.valueOf(balance);
|
||||
|
||||
@@ -9,11 +9,14 @@ import com.massivecraft.factions.zcore.util.TL;
|
||||
import org.bukkit.command.CommandSender;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public abstract class FCommand extends MCommand<P> {
|
||||
|
||||
public SimpleDateFormat sdf = new SimpleDateFormat(TL.DATE_FORMAT.toString());
|
||||
|
||||
public boolean disableOnLock;
|
||||
|
||||
public FPlayer fme;
|
||||
|
||||
Reference in New Issue
Block a user