Territory Titles Toggle Command

This commit is contained in:
Olof Larsson
2015-08-28 09:00:24 +02:00
parent 89b93801d0
commit 8eaf1215d2
7 changed files with 187 additions and 90 deletions

View File

@ -270,13 +270,13 @@ public class MConf extends Entity<MConf>
// TERRITORY INFO
// -------------------------------------------- //
public boolean territoryInfoUseScreen = true;
public boolean territoryInfoTitlesDefault = true;
public String territoryInfoScreenMaintitle = "{relcolor}{name}";
public String territoryInfoScreenSubtitle = "<i>{desc}";
public int territoryInfoScreenTicksIn = 5;
public int territoryInfoScreenTicksStay = 60;
public int territoryInfoScreenTicksOut = 5;
public String territoryInfoTitlesMain = "{relcolor}{name}";
public String territoryInfoTitlesSub = "<i>{desc}";
public int territoryInfoTitlesTicksIn = 5;
public int territoryInfoTitlesTicksStay = 60;
public int territoryInfoTitleTicksOut = 5;
public String territoryInfoChat = "<i> ~ {relcolor}{name} <i>{desc}";

View File

@ -58,6 +58,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
this.setPower(that.power);
this.setMapAutoUpdating(that.mapAutoUpdating);
this.setUsingAdminMode(that.usingAdminMode);
this.setTerritoryInfoTitles(that.territoryInfoTitles);
return this;
}
@ -73,6 +74,7 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
if (this.getPowerRounded() != (int) Math.round(MConf.get().defaultPlayerPower)) return false;
// if (this.isMapAutoUpdating()) return false; // Just having an auto updating map is not in itself reason enough for database storage.
if (this.isUsingAdminMode()) return false;
if (this.isTerritoryInfoTitles() != MConf.get().territoryInfoTitlesDefault) return false;
return true;
}
@ -158,6 +160,10 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
// Null means false
private Boolean usingAdminMode = null;
// Does this player use titles for territory info?
// Null means default specified in MConf.
private Boolean territoryInfoTitles = null;
// The id for the faction this player is currently autoclaiming for.
// Null means the player isn't auto claiming.
// NOTE: This field will not be saved to the database ever.
@ -561,6 +567,33 @@ public class MPlayer extends SenderEntity<MPlayer> implements EconomyParticipato
this.changed();
}
// -------------------------------------------- //
// FIELD: territoryInfoTitles
// -------------------------------------------- //
public boolean isTerritoryInfoTitles()
{
if ( ! Mixin.isTitlesAvailable()) return false;
if (this.territoryInfoTitles == null) return MConf.get().territoryInfoTitlesDefault;
return this.territoryInfoTitles;
}
public void setTerritoryInfoTitles(Boolean territoryInfoTitles)
{
// Clean input
Boolean target = territoryInfoTitles;
if (MUtil.equals(target, MConf.get().territoryInfoTitlesDefault)) target = null;
// Detect Nochange
if (MUtil.equals(this.territoryInfoTitles, target)) return;
// Apply
this.territoryInfoTitles = target;
// Mark as changed
this.changed();
}
// -------------------------------------------- //
// TITLE, NAME, FACTION NAME AND CHAT
// -------------------------------------------- //