diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 00000000..5cceccfc Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/main/java/com/massivecraft/factions/FPlayer.java b/src/main/java/com/massivecraft/factions/FPlayer.java index eb603f32..91d99f25 100644 --- a/src/main/java/com/massivecraft/factions/FPlayer.java +++ b/src/main/java/com/massivecraft/factions/FPlayer.java @@ -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("Limit reached. You can't claim more land!"); } else if (currentFaction.getRelationTo(forFaction) == Relation.ALLY) { error = P.p.txt.parse("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("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; } diff --git a/src/main/java/com/massivecraft/factions/Faction.java b/src/main/java/com/massivecraft/factions/Faction.java index 5e376812..16b32016 100644 --- a/src/main/java/com/massivecraft/factions/Faction.java +++ b/src/main/java/com/massivecraft/factions/Faction.java @@ -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; } } diff --git a/src/main/java/com/massivecraft/factions/Factions.java b/src/main/java/com/massivecraft/factions/Factions.java index cdf7f4d2..30e42003 100644 --- a/src/main/java/com/massivecraft/factions/Factions.java +++ b/src/main/java/com/massivecraft/factions/Factions.java @@ -40,6 +40,13 @@ public class Factions extends EntityCollection { 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.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.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(" ")) diff --git a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java index b975718f..f43ee3e4 100644 --- a/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/main/java/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -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("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("You can't use the command \"" + fullCmd + "\" in enemy territory."); return true; }