Adding in Faction creation timestamp. You can now see how old the faction is.

This commit is contained in:
Olof Larsson
2013-04-25 10:51:11 +02:00
parent 0ed104279f
commit 0fd21575e4
4 changed files with 38 additions and 3 deletions

View File

@ -44,6 +44,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
{
this.setName(that.name);
this.setDescription(that.description);
this.setCreatedAtMillis(that.createdAtMillis);
this.setHome(that.home);
this.setPowerBoost(that.powerBoost);
this.setOpen(that.open);
@ -71,6 +72,10 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
// Null means the faction has no description.
private String description = null;
// We store the creation date for the faction.
// It can be displayed on info pages etc.
private long createdAtMillis = System.currentTimeMillis();
// Factions can optionally set a home location.
// If they do their members can teleport there using /f home
// Null means the faction has no home.
@ -213,6 +218,30 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
this.changed();
}
// -------------------------------------------- //
// FIELD: createdAtMillis
// -------------------------------------------- //
public long getCreatedAtMillis()
{
return this.createdAtMillis;
}
public void setCreatedAtMillis(long createdAtMillis)
{
// Clean input
long target = createdAtMillis;
// Detect Nochange
if (MUtil.equals(this.createdAtMillis, createdAtMillis)) return;
// Apply
this.createdAtMillis = target;
// Mark as changed
this.changed();
}
// -------------------------------------------- //
// FIELD: home
// -------------------------------------------- //