Update default factions description and tags if changed in the lang file.

This commit is contained in:
drtshock 2014-07-01 13:46:30 -05:00
parent cd65375bd9
commit 672e115d8b
5 changed files with 33 additions and 64 deletions

BIN
src/.DS_Store vendored Normal file

Binary file not shown.

View File

@ -355,7 +355,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
return this.getRelationColor(fplayer)+this.getNameAndTag();
}*/
// TODO: REmovded for refactoring.
// TODO: Removed for refactoring.
/*public String getNameAndRelevant(Faction faction)
{
@ -624,13 +624,10 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
public boolean canClaimForFaction(Faction forFaction) {
if (forFaction.isNone()) return false;
if
(
this.isAdminBypassing()
if (this.isAdminBypassing()
|| (forFaction == this.getFaction() && this.getRole().isAtLeast(Role.MODERATOR))
|| (forFaction.isSafeZone() && Permission.MANAGE_SAFE_ZONE.has(getPlayer()))
|| (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer()))
) {
|| (forFaction.isWarZone() && Permission.MANAGE_WAR_ZONE.has(getPlayer()))) {
return true;
}
@ -673,14 +670,11 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
error = P.p.txt.parse("<b>Limit reached. You can't claim more land!");
} else if (currentFaction.getRelationTo(forFaction) == Relation.ALLY) {
error = P.p.txt.parse("<b>You can't claim the land of your allies.");
} else if
(
Conf.claimsMustBeConnected
} else if (Conf.claimsMustBeConnected
&& !this.isAdminBypassing()
&& myFaction.getLandRoundedInWorld(flocation.getWorldName()) > 0
&& !Board.isConnectedLocation(flocation, myFaction)
&& (!Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !currentFaction.isNormal())
) {
&& (!Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction || !currentFaction.isNormal())) {
if (Conf.claimsCanBeUnconnectedIfOwnedByOtherFaction)
error = P.p.txt.parse("<b>You can only claim additional land which is connected to your first claim or controlled by another faction!");
else
@ -762,9 +756,7 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator {
@Override
public boolean shouldBeSaved() {
if (!this.hasFaction() &&
(this.getPowerRounded() == this.getPowerMaxRounded() || this.getPowerRounded() == (int) Math.round(Conf.powerPlayerStarting))
)
if (!this.hasFaction() && (this.getPowerRounded() == this.getPowerMaxRounded() || this.getPowerRounded() == (int) Math.round(Conf.powerPlayerStarting)))
return false;
return !this.deleteMe;
}

View File

@ -461,7 +461,7 @@ public class Faction extends Entity implements EconomyParticipator {
for (Player player : P.p.getServer().getOnlinePlayers()) {
FPlayer fplayer = FPlayers.i.get(player);
if (fplayer.getFaction() == this) {
if (fplayer != null && fplayer.getFaction() == this) {
return true;
}
}

View File

@ -40,6 +40,13 @@ public class Factions extends EntityCollection<Faction> {
Faction faction = this.create("0");
faction.setTag(TL.WILDERNESS.toString());
faction.setDescription(TL.WILDERNESS_DESCRIPTION.toString());
} else {
if (!this.get("0").getTag().equalsIgnoreCase(TL.WILDERNESS.toString())) {
get("0").setTag(TL.WILDERNESS.toString());
}
if (!this.get("0").getDescription().equalsIgnoreCase(TL.WILDERNESS_DESCRIPTION.toString())) {
get("0").setDescription(TL.WILDERNESS_DESCRIPTION.toString());
}
}
// Make sure the safe zone faction exists
@ -48,6 +55,12 @@ public class Factions extends EntityCollection<Faction> {
faction.setTag(TL.SAFEZONE.toString());
faction.setDescription(TL.SAFEZONE_DESCRIPTION.toString());
} else {
if (!getSafeZone().getTag().equalsIgnoreCase(TL.SAFEZONE.toString())) {
getSafeZone().setTag(TL.SAFEZONE.toString());
}
if(!getSafeZone().getDescription().equalsIgnoreCase(TL.SAFEZONE_DESCRIPTION.toString())) {
getSafeZone().setDescription(TL.SAFEZONE_DESCRIPTION.toString());
}
// if SafeZone has old pre-1.6.0 name, rename it to remove troublesome " "
Faction faction = this.getSafeZone();
if (faction.getTag().contains(" "))
@ -60,6 +73,12 @@ public class Factions extends EntityCollection<Faction> {
faction.setTag(TL.WARZONE.toString());
faction.setDescription(TL.WARZONE_DESCRIPTION.toString());
} else {
if (!getWarZone().getTag().equalsIgnoreCase(TL.WARZONE.toString())) {
getWarZone().setTag(TL.WARZONE.toString());
}
if(!getWarZone().getDescription().equalsIgnoreCase(TL.WARZONE_DESCRIPTION.toString())) {
getWarZone().setDescription(TL.WARZONE_DESCRIPTION.toString());
}
// if WarZone has old pre-1.6.0 name, rename it to remove troublesome " "
Faction faction = this.getWarZone();
if (faction.getTag().contains(" "))

View File

@ -60,14 +60,9 @@ public class FactionsPlayerListener implements Listener {
if (event.isCancelled()) return;
// quick check to make sure player is moving between chunks; good performance boost
if
(
event.getFrom().getBlockX() >> 4 == event.getTo().getBlockX() >> 4
&&
event.getFrom().getBlockZ() >> 4 == event.getTo().getBlockZ() >> 4
&&
event.getFrom().getWorld() == event.getTo().getWorld()
)
if(event.getFrom().getBlockX() >> 4 == event.getTo().getBlockX() >> 4
&& event.getFrom().getBlockZ() >> 4 == event.getTo().getBlockZ() >> 4
&& event.getFrom().getWorld() == event.getTo().getWorld())
return;
Player player = event.getPlayer();
@ -97,35 +92,16 @@ public class FactionsPlayerListener implements Listener {
if (me.isMapAutoUpdating()) {
me.sendMessage(Board.getMap(me.getFaction(), to, player.getLocation().getYaw()));
} else {
Faction myFaction = me.getFaction();
String ownersTo = myFaction.getOwnerListString(to);
if (changedFaction) {
me.sendFactionHereMessage();
if
(
Conf.ownedAreasEnabled
&&
Conf.ownedMessageOnBorder
&&
myFaction == factionTo
&&
!ownersTo.isEmpty()
) {
if (Conf.ownedAreasEnabled && Conf.ownedMessageOnBorder &&myFaction == factionTo && !ownersTo.isEmpty()) {
me.sendMessage(Conf.ownedLandMessage + ownersTo);
}
} else if
(
Conf.ownedAreasEnabled
&&
Conf.ownedMessageInsideTerritory
&&
factionFrom == factionTo
&&
myFaction == factionTo
) {
} else if (Conf.ownedAreasEnabled && Conf.ownedMessageInsideTerritory && factionFrom == factionTo &&myFaction == factionTo) {
String ownersFrom = myFaction.getOwnerListString(from);
if (Conf.ownedMessageByChunk || !ownersFrom.equals(ownersTo)) {
if (!ownersTo.isEmpty())
@ -423,30 +399,12 @@ public class FactionsPlayerListener implements Listener {
return false;
}
if
(
rel.isNeutral()
&&
!Conf.territoryNeutralDenyCommands.isEmpty()
&&
!me.isAdminBypassing()
&&
isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())
) {
if (rel.isNeutral() && !Conf.territoryNeutralDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryNeutralDenyCommands.iterator())) {
me.msg("<b>You can't use the command \"" + fullCmd + "\" in neutral territory.");
return true;
}
if
(
rel.isEnemy()
&&
!Conf.territoryEnemyDenyCommands.isEmpty()
&&
!me.isAdminBypassing()
&&
isCommandInList(fullCmd, shortCmd, Conf.territoryEnemyDenyCommands.iterator())
) {
if (rel.isEnemy() && !Conf.territoryEnemyDenyCommands.isEmpty() && !me.isAdminBypassing() && isCommandInList(fullCmd, shortCmd, Conf.territoryEnemyDenyCommands.iterator())) {
me.msg("<b>You can't use the command \"" + fullCmd + "\" in enemy territory.");
return true;
}