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

View File

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

View File

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

View File

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