Adds DTR freeze functionality from #229.
This commit is contained in:
parent
8fdcb51183
commit
1636708cef
@ -111,6 +111,10 @@ public interface Faction extends EconomyParticipator {
|
|||||||
|
|
||||||
public boolean isPlayerFreeType();
|
public boolean isPlayerFreeType();
|
||||||
|
|
||||||
|
public boolean isPowerFrozen();
|
||||||
|
|
||||||
|
public void setLastDeath(long time);
|
||||||
|
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
// Relation and relation colors
|
// Relation and relation colors
|
||||||
// -------------------------------
|
// -------------------------------
|
||||||
|
@ -486,6 +486,8 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
if (!Conf.powerRegenOffline) {
|
if (!Conf.powerRegenOffline) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} else if (hasFaction() && getFaction().isPowerFrozen()) {
|
||||||
|
return; // Don't let power regen if faction power is frozen.
|
||||||
}
|
}
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
long millisPassed = now - this.lastPowerUpdateTime;
|
long millisPassed = now - this.lastPowerUpdateTime;
|
||||||
@ -517,6 +519,9 @@ public abstract class MemoryFPlayer implements FPlayer {
|
|||||||
public void onDeath() {
|
public void onDeath() {
|
||||||
this.updatePower();
|
this.updatePower();
|
||||||
this.alterPower(-Conf.powerPerDeath);
|
this.alterPower(-Conf.powerPerDeath);
|
||||||
|
if (hasFaction()) {
|
||||||
|
getFaction().setLastDeath(System.currentTimeMillis());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------//
|
//----------------------------------------------//
|
||||||
|
@ -40,6 +40,7 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
protected Set<String> invites = new HashSet<String>();
|
protected Set<String> invites = new HashSet<String>();
|
||||||
protected HashMap<String, List<String>> announcements = new HashMap<String, List<String>>();
|
protected HashMap<String, List<String>> announcements = new HashMap<String, List<String>>();
|
||||||
protected ConcurrentHashMap<String, LazyLocation> warps = new ConcurrentHashMap<String, LazyLocation>();
|
protected ConcurrentHashMap<String, LazyLocation> warps = new ConcurrentHashMap<String, LazyLocation>();
|
||||||
|
protected long lastDeath;
|
||||||
|
|
||||||
public HashMap<String, List<String>> getAnnouncements() {
|
public HashMap<String, List<String>> getAnnouncements() {
|
||||||
return this.announcements;
|
return this.announcements;
|
||||||
@ -247,6 +248,19 @@ public abstract class MemoryFaction implements Faction, EconomyParticipator {
|
|||||||
this.powerBoost = powerBoost;
|
this.powerBoost = powerBoost;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isPowerFrozen() {
|
||||||
|
int freezeSeconds = P.p.getConfig().getInt("hcf.powerfreeze", 0);
|
||||||
|
if (freezeSeconds == 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return System.currentTimeMillis() - lastDeath < freezeSeconds * 1000;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLastDeath(long time) {
|
||||||
|
this.lastDeath = time;
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
// Construct
|
// Construct
|
||||||
// -------------------------------------------- //
|
// -------------------------------------------- //
|
||||||
|
@ -182,4 +182,10 @@ hcf:
|
|||||||
|
|
||||||
# Should we allow Factions to over claim if they are raidable (above has no effect on this)?
|
# Should we allow Factions to over claim if they are raidable (above has no effect on this)?
|
||||||
# This has always been true, allowing factions to over claim others.
|
# This has always been true, allowing factions to over claim others.
|
||||||
overclaim: true
|
overclaim: true
|
||||||
|
|
||||||
|
# Power Freeze
|
||||||
|
# After a player dies, how long should the faction not be able to regen power?
|
||||||
|
# This resets on each death but does not accumulate.
|
||||||
|
# Set to 0 for no freeze. Time is in seconds.
|
||||||
|
powerfreeze: 0
|
Loading…
Reference in New Issue
Block a user