Adds Faction founding date
..but does not implement it. Future commit will need to add this to /f show.
This commit is contained in:
parent
362bb55a0f
commit
dbba8c055c
@ -83,6 +83,10 @@ public interface Faction extends EconomyParticipator {
|
||||
|
||||
public Location getHome();
|
||||
|
||||
public long getFoundedDate();
|
||||
|
||||
public void setFoundedDate(long newDate);
|
||||
|
||||
public void confirmValidHome();
|
||||
|
||||
public String getAccountId();
|
||||
|
@ -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
|
||||
@ -162,6 +177,8 @@ 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.
|
||||
|
@ -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;
|
||||
|
@ -676,6 +676,7 @@ public enum TL {
|
||||
DEFAULT_PREFIX("default-prefix", "{relationcolor}[{faction}] &r"),
|
||||
FACTION_LOGIN("faction-login", "&e%1$s &9logged in."),
|
||||
FACTION_LOGOUT("faction-logout", "&e%1$s &9logged out.."),
|
||||
DATE_FORMAT("date-format", "MM/d/yy h:ma"), // 3/31/15 07:49AM
|
||||
|
||||
/**
|
||||
* Raidable is used in multiple places. Allow more than just true/false.
|
||||
|
Loading…
Reference in New Issue
Block a user