diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index eb11a452..f058677b 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -71,9 +71,6 @@ public class FPlayer extends SenderEntity implements EconomyParticipato public boolean hasFaction() { return this.factionId != null && ! factionId.equals(Const.FACTIONID_NONE); } public void setFaction(Faction faction) { - Faction oldFaction = this.getFaction(); - if (oldFaction != null) oldFaction.removeFPlayer(this); - faction.addFPlayer(this); this.factionId = faction.getId(); SpoutFeatures.updateTitle(this, null); SpoutFeatures.updateTitle(null, this); @@ -157,15 +154,6 @@ public class FPlayer extends SenderEntity implements EconomyParticipato public final void resetFactionData(boolean doSpoutUpdate) { - if (this.factionId != null && FactionColl.get().containsId(this.factionId)) // Avoid infinite loop! TODO: I think that this is needed is a sign we need to refactor. - { - Faction currentFaction = this.getFaction(); - if (currentFaction != null) - { - currentFaction.removeFPlayer(this); - } - } - // TODO: Should we not rather use ConfServer.newPlayerStartingFactionID here? this.factionId = Const.FACTIONID_NONE; // The default neutral faction @@ -476,7 +464,7 @@ public class FPlayer extends SenderEntity implements EconomyParticipato } Faction factionHere = BoardColl.get().getFactionAt(this.getCurrentChunk()); String msg = Txt.parse("")+" ~ "+factionHere.getTag(this); - if (factionHere.getDescription().length() > 0) + if (factionHere.hasDescription()) { msg += " - "+factionHere.getDescription(); } @@ -564,7 +552,7 @@ public class FPlayer extends SenderEntity implements EconomyParticipato PS ps = PS.valueOf(location); Faction myFaction = this.getFaction(); Faction currentFaction = BoardColl.get().getFactionAt(ps); - int ownedLand = forFaction.getLandRounded(); + int ownedLand = forFaction.getLandCount(); if (ConfServer.worldGuardChecking && Worldguard.checkForRegionsInChunk(location)) { @@ -611,7 +599,7 @@ public class FPlayer extends SenderEntity implements EconomyParticipato ( ConfServer.claimsMustBeConnected && ! this.isUsingAdminMode() - && myFaction.getLandRoundedInWorld(ps.getWorld()) > 0 + && myFaction.getLandCountInWorld(ps.getWorld()) > 0 && !BoardColl.get().isConnectedPs(ps, myFaction) && (!ConfServer.claimsCanBeUnconnectedIfOwnedByOtherFaction || !currentFaction.isNormal()) ) @@ -649,7 +637,7 @@ public class FPlayer extends SenderEntity implements EconomyParticipato PS flocation = PS.valueOf(location).getChunk(true); Faction currentFaction = BoardColl.get().getFactionAt(flocation); - int ownedLand = forFaction.getLandRounded(); + int ownedLand = forFaction.getLandCount(); if ( ! this.canClaimForFactionAtLocation(forFaction, location, notifyFailure)) return false; @@ -662,7 +650,7 @@ public class FPlayer extends SenderEntity implements EconomyParticipato { cost = Econ.calculateClaimCost(ownedLand, currentFaction.isNormal()); - if (ConfServer.econClaimUnconnectedFee != 0.0 && forFaction.getLandRoundedInWorld(flocation.getWorld()) > 0 && !BoardColl.get().isConnectedPs(flocation, forFaction)) + if (ConfServer.econClaimUnconnectedFee != 0.0 && forFaction.getLandCountInWorld(flocation.getWorld()) > 0 && !BoardColl.get().isConnectedPs(flocation, forFaction)) cost += ConfServer.econClaimUnconnectedFee; if(ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts && this.hasFaction()) diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index d6d081db..aaa2b9cb 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -2,8 +2,10 @@ package com.massivecraft.factions; import java.util.*; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Location; +import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; import com.massivecraft.factions.iface.EconomyParticipator; @@ -13,7 +15,7 @@ import com.massivecraft.factions.integration.SpoutFeatures; import com.massivecraft.factions.util.*; import com.massivecraft.mcore.ps.PS; import com.massivecraft.mcore.store.Entity; -import com.massivecraft.mcore.util.Txt; +import com.massivecraft.mcore.util.SenderUtil; import com.massivecraft.mcore.xlib.gson.annotations.SerializedName; @@ -39,7 +41,7 @@ public class Faction extends Entity implements EconomyParticipator this.invitedPlayerIds = that.invitedPlayerIds; this.open = that.open; this.tag = that.tag; - this.description = that.description; + this.setDescription(that.description); this.home = that.home; this.cape = that.cape; this.powerBoost = that.powerBoost; @@ -53,10 +55,6 @@ public class Faction extends Entity implements EconomyParticipator // FIELDS: RAW // -------------------------------------------- // - // speedy lookup of players in faction - private transient Set fplayers = new HashSet(); - // TODO - private Map relationWish; // TODO @@ -84,8 +82,7 @@ public class Faction extends Entity implements EconomyParticipator this.invitedPlayerIds = target; } - // TODO: Add when we use a true mcore entity. - // this.changed(); + this.changed(); } private boolean open; @@ -116,10 +113,31 @@ public class Faction extends Entity implements EconomyParticipator // FIELD: description private String description; - public String getDescription() { return this.description; } - public void setDescription(String value) { this.description = value; } + public boolean hasDescription() + { + return this.description != null; + } + public String getDescription() + { + if (this.hasDescription()) return this.description; + return Lang.FACTION_NODESCRIPTION; + } + public void setDescription(String description) + { + if (description != null) + { + description = description.trim(); + // This code should be kept for a while to clean out the previous default text that was actually stored in the database. + if (description.length() == 0 || description.equalsIgnoreCase("Default faction description :(")) + { + description = null; + } + } + this.description = description; + } // FIELD: home + // TODO: Use a PS instead! private LazyLocation home; public void setHome(Location home) { this.home = new LazyLocation(home); } public boolean hasHome() { return this.getHome() != null; } @@ -166,8 +184,6 @@ public class Faction extends Entity implements EconomyParticipator // FIELDS: Flag management // TODO: This will save... defaults if they where changed to... - - private Map flagOverrides; // Contains the modifications to the default values public boolean getFlag(FFlag flag) { @@ -245,15 +261,15 @@ public class Faction extends Entity implements EconomyParticipator // -------------------------------------------- // - // Construct + // CONSTRUCT // -------------------------------------------- // public Faction() { - this.relationWish = new HashMap(); + this.relationWish = new LinkedHashMap(); this.open = ConfServer.newFactionsDefaultOpen; this.tag = "???"; - this.description = "Default faction description :("; + this.description = null; this.powerBoost = 0.0; this.flagOverrides = new LinkedHashMap(); this.permOverrides = new LinkedHashMap>(); @@ -306,26 +322,23 @@ public class Faction extends Entity implements EconomyParticipator this.removeInvitedPlayerId(fplayer.getId()); } - // ------------------------------- - // Understand the types - // ------------------------------- - - // TODO: These should be gone after the refactoring... - - public boolean isNormal() - { - //return ! (this.isNone() || this.isSafeZone() || this.isWarZone()); - return ! this.isNone(); - } + // -------------------------------------------- // + // NONE OR NORMAL? + // -------------------------------------------- // public boolean isNone() { return this.getId().equals(Const.FACTIONID_NONE); } - // ------------------------------- - // Relation and relation colors - // ------------------------------- + public boolean isNormal() + { + return ! this.isNone(); + } + + // -------------------------------------------- // + // RELATION AND COLORS + // -------------------------------------------- // @Override public String describeTo(RelationParticipator observer, boolean ucfirst) @@ -402,8 +415,9 @@ public class Faction extends Entity implements EconomyParticipator // TODO: Implement a has enough feature. // -------------------------------------------- // - // Power + // POWER // -------------------------------------------- // + public double getPower() { if (this.getFlag(FFlag.INFPOWER)) @@ -412,7 +426,7 @@ public class Faction extends Entity implements EconomyParticipator } double ret = 0; - for (FPlayer fplayer : fplayers) + for (FPlayer fplayer : this.getFPlayers()) { ret += fplayer.getPower(); } @@ -431,7 +445,7 @@ public class Faction extends Entity implements EconomyParticipator } double ret = 0; - for (FPlayer fplayer : fplayers) + for (FPlayer fplayer : this.getFPlayers()) { ret += fplayer.getPowerMax(); } @@ -452,147 +466,125 @@ public class Faction extends Entity implements EconomyParticipator return (int) Math.round(this.getPowerMax()); } - // TODO: Why "rounded"? Rename to getLandCount? or getChunkCount? - public int getLandRounded() + public int getLandCount() { return BoardColl.get().getCount(this); } - public int getLandRoundedInWorld(String worldName) + public int getLandCountInWorld(String worldName) { return BoardColl.get().get(worldName).getCount(this); } public boolean hasLandInflation() { - return this.getLandRounded() > this.getPowerRounded(); + return this.getLandCount() > this.getPowerRounded(); } // -------------------------------------------- // - // FPlayers + // FPLAYERS // -------------------------------------------- // - // maintain the reference list of FPlayers in this faction - public void refreshFPlayers() + public List getFPlayers() { - fplayers.clear(); - if (this.isNone()) return; - + List ret = new ArrayList(); for (FPlayer fplayer : FPlayerColl.get().getAll()) { - if (fplayer.getFaction() == this) - { - fplayers.add(fplayer); - } + if (fplayer.getFaction() != this) continue; + ret.add(fplayer); } - } - protected boolean addFPlayer(FPlayer fplayer) - { - if (this.isNone()) return false; - - return fplayers.add(fplayer); - } - protected boolean removeFPlayer(FPlayer fplayer) - { - if (this.isNone()) return false; - - return fplayers.remove(fplayer); - } - - public Set getFPlayers() - { - // return a shallow copy of the FPlayer list, to prevent tampering and concurrency issues - Set ret = new HashSet(fplayers); return ret; } - public Set getFPlayersWhereOnline(boolean online) + public List getFPlayersWhereOnline(boolean online) { - Set ret = new HashSet(); - - for (FPlayer fplayer : fplayers) + List ret = new ArrayList(); + for (FPlayer fplayer : FPlayerColl.get().getAll()) { - if (fplayer.isOnline() == online) - { - ret.add(fplayer); - } + if (fplayer.getFaction() != this) continue; + if (fplayer.isOnline() != online) continue; + ret.add(fplayer); } - return ret; } - public FPlayer getFPlayerLeader() + public List getFPlayersWhereRole(Rel role) { - //if ( ! this.isNormal()) return null; - - for (FPlayer fplayer : fplayers) + List ret = new ArrayList(); + for (FPlayer fplayer : FPlayerColl.get().getAll()) { - if (fplayer.getRole() == Rel.LEADER) - { - return fplayer; - } + if (fplayer.getFaction() != this) continue; + if (fplayer.getRole() != role) continue; + ret.add(fplayer); + } + return ret; + } + + public FPlayer getLeader() + { + for (FPlayer fplayer : FPlayerColl.get().getAll()) + { + if (fplayer.getFaction() != this) continue; + if (fplayer.getRole() != Rel.LEADER) continue; + return fplayer; } return null; } - public ArrayList getFPlayersWhereRole(Rel role) + public List getOnlineCommandSenders() { - ArrayList ret = new ArrayList(); - //if ( ! this.isNormal()) return ret; - - for (FPlayer fplayer : fplayers) + List ret = new ArrayList(); + for (CommandSender player : SenderUtil.getOnlineSenders()) { - if (fplayer.getRole() == role) - { - ret.add(fplayer); - } + FPlayer fplayer = FPlayerColl.get().get(player); + if (fplayer.getFaction() != this) continue; + ret.add(player); } - return ret; } - // TODO: Makes use of bukkit instead of mixin. Fix that? - public ArrayList getOnlinePlayers() + public List getOnlinePlayers() { - ArrayList ret = new ArrayList(); - //if (this.isPlayerFreeType()) return ret; - - for (Player player: Factions.get().getServer().getOnlinePlayers()) + List ret = new ArrayList(); + for (Player player : Bukkit.getOnlinePlayers()) { FPlayer fplayer = FPlayerColl.get().get(player); - if (fplayer.getFaction() == this) - { - ret.add(player); - } + if (fplayer.getFaction() != this) continue; + ret.add(player); } - return ret; } // used when current leader is about to be removed from the faction; promotes new leader, or disbands faction if no other members left public void promoteNewLeader() { - if (! this.isNormal()) return; + if ( ! this.isNormal()) return; if (this.getFlag(FFlag.PERMANENT) && ConfServer.permanentFactionsDisableLeaderPromotion) return; - FPlayer oldLeader = this.getFPlayerLeader(); + FPlayer oldLeader = this.getLeader(); // get list of officers, or list of normal members if there are no officers - ArrayList replacements = this.getFPlayersWhereRole(Rel.OFFICER); + List replacements = this.getFPlayersWhereRole(Rel.OFFICER); if (replacements == null || replacements.isEmpty()) + { replacements = this.getFPlayersWhereRole(Rel.MEMBER); + } if (replacements == null || replacements.isEmpty()) { // faction leader is the only member; one-man faction if (this.getFlag(FFlag.PERMANENT)) { if (oldLeader != null) + { oldLeader.setRole(Rel.MEMBER); + } return; } // no members left and faction isn't permanent, so disband it if (ConfServer.logFactionDisband) + { Factions.get().log("The faction "+this.getTag()+" ("+this.getId()+") has been disbanded since it has no members left."); + } for (FPlayer fplayer : FPlayerColl.get().getAllOnline()) { @@ -604,7 +596,10 @@ public class Faction extends Entity implements EconomyParticipator else { // promote new faction leader if (oldLeader != null) + { oldLeader.setRole(Rel.MEMBER); + } + replacements.get(0).setRole(Rel.LEADER); this.msg("Faction leader %s has been removed. %s has been promoted as the new faction leader.", oldLeader == null ? "" : oldLeader.getName(), replacements.get(0).getName()); Factions.get().log("Faction "+this.getTag()+" ("+this.getId()+") leader was removed. Replacement leader: "+replacements.get(0).getName()); @@ -612,37 +607,66 @@ public class Faction extends Entity implements EconomyParticipator } // -------------------------------------------- // - // Messages + // MESSAGES // -------------------------------------------- // + // These methods are simply proxied in from the SenderEntity class using a for loop. - // TODO: Invalid code since Mixin introduction. Fix this. - public boolean msg(String message, Object... args) + // CONVENIENCE SEND MESSAGE + + public boolean sendMessage(String message) { - message = Txt.parse(message, args); - - for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) + for (FPlayer fplayer : this.getFPlayers()) { fplayer.sendMessage(message); } - return true; } - public void sendMessage(String message) + public boolean sendMessage(String... messages) { - for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) - { - fplayer.sendMessage(message); - } - } - - public void sendMessage(List messages) - { - for (FPlayer fplayer : this.getFPlayersWhereOnline(true)) + for (FPlayer fplayer : this.getFPlayers()) { fplayer.sendMessage(messages); } + return true; } + public boolean sendMessage(Collection messages) + { + for (FPlayer fplayer : this.getFPlayers()) + { + fplayer.sendMessage(messages); + } + return true; + } + + // CONVENIENCE MSG + + public boolean msg(String msg) + { + for (FPlayer fplayer : this.getFPlayers()) + { + fplayer.msg(msg); + } + return true; + } + + public boolean msg(String msg, Object... args) + { + for (FPlayer fplayer : this.getFPlayers()) + { + fplayer.msg(msg, args); + } + return true; + } + + public boolean msg(Collection msgs) + { + for (FPlayer fplayer : this.getFPlayers()) + { + fplayer.msg(msgs); + } + return true; + } } diff --git a/src/com/massivecraft/factions/FactionColl.java b/src/com/massivecraft/factions/FactionColl.java index 54712fb2..aacc53b4 100644 --- a/src/com/massivecraft/factions/FactionColl.java +++ b/src/com/massivecraft/factions/FactionColl.java @@ -40,15 +40,7 @@ public class FactionColl extends Coll this.migrate(); - this.createDefaultFactions(); - - // TODO: Refactor and fix with the member-index. - // populate all faction player lists - // or as you also could describe it: Reindex of Members - for (Faction faction : this.getAll()) - { - faction.refreshFPlayers(); - } + this.createDefaultFactions(); } public void migrate() @@ -194,10 +186,10 @@ public class FactionColl extends Coll Factions.get().log("Running econLandRewardRoutine..."); for (Faction faction : this.getAll()) { - int landCount = faction.getLandRounded(); + int landCount = faction.getLandCount(); if (!faction.getFlag(FFlag.PEACEFUL) && landCount > 0) { - Set players = faction.getFPlayers(); + List players = faction.getFPlayers(); int playerCount = players.size(); double reward = ConfServer.econLandReward * landCount / playerCount; for (FPlayer player : players) diff --git a/src/com/massivecraft/factions/FactionListComparator.java b/src/com/massivecraft/factions/FactionListComparator.java index 9c08495c..d5d284ab 100644 --- a/src/com/massivecraft/factions/FactionListComparator.java +++ b/src/com/massivecraft/factions/FactionListComparator.java @@ -28,7 +28,7 @@ public class FactionListComparator implements Comparator if (f2 == null) ret = +1; if (ret != 0) return ret; - // None + // None a.k.a. Wilderness if (f1.isNone() && f2.isNone()) ret = 0; if (f1.isNone()) ret = -1; if (f2.isNone()) ret = +1; diff --git a/src/com/massivecraft/factions/Lang.java b/src/com/massivecraft/factions/Lang.java new file mode 100644 index 00000000..a300e038 --- /dev/null +++ b/src/com/massivecraft/factions/Lang.java @@ -0,0 +1,8 @@ +package com.massivecraft.factions; + +import com.massivecraft.mcore.util.Txt; + +public class Lang +{ + public static final String FACTION_NODESCRIPTION = Txt.parse("no description set"); +} diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java index 542c7122..ef1409f0 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDescription.java @@ -7,7 +7,6 @@ import com.massivecraft.factions.Perm; import com.massivecraft.factions.Rel; import com.massivecraft.factions.cmd.req.ReqRoleIsAtLeast; import com.massivecraft.mcore.cmd.req.ReqHasPerm; -import com.massivecraft.mcore.util.Txt; public class CmdFactionsDescription extends FCommand { @@ -28,22 +27,21 @@ public class CmdFactionsDescription extends FCommand // if economy is enabled, they're not on the bypass list, and this command has a cost set, make 'em pay if ( ! payForCommand(ConfServer.econCostDesc, "to change faction description", "for changing faction description")) return; - // TODO: This must be an invalid replace-approach. The call order is wrong somehow? - myFaction.setDescription(Txt.implode(args, " ").replaceAll("(&([a-f0-9]))", "& $2")); // since "&" color tags seem to work even through plain old FPlayer.sendMessage() for some reason, we need to break those up - - if ( ! ConfServer.broadcastDescriptionChanges) + if (ConfServer.broadcastDescriptionChanges) + { + // Broadcast the description to everyone + for (FPlayer fplayer : FPlayerColl.get().getAllOnline()) + { + fplayer.msg("%s changed their description to:", myFaction.describeTo(fplayer)); + fplayer.sendMessage(myFaction.getDescription()); + } + } + else { fme.msg("You have changed the description for %s to:", myFaction.describeTo(fme)); fme.sendMessage(myFaction.getDescription()); - return; - } - - // Broadcast the description to everyone - for (FPlayer fplayer : FPlayerColl.get().getAllOnline()) - { - fplayer.msg("%s changed their description to:", myFaction.describeTo(fplayer)); - fplayer.sendMessage(myFaction.getDescription()); // players can inject "&" or "`" or "" or whatever in their description, thus exploitable (masquerade as server messages or whatever); by the way, &k is particularly interesting looking } + } } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java index 20d9a5da..4614aa53 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java @@ -35,7 +35,7 @@ public class CmdFactionsLeader extends FCommand Faction targetFaction = this.arg(1, ARFaction.get(), myFaction); if (targetFaction == null) return; - FPlayer targetFactionCurrentLeader = targetFaction.getFPlayerLeader(); + FPlayer targetFactionCurrentLeader = targetFaction.getLeader(); // We now have fplayer and the target faction if (this.senderIsConsole || fme.isUsingAdminMode() || Perm.LEADER_ANY.has(sender, false)) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsList.java b/src/com/massivecraft/factions/cmd/CmdFactionsList.java index 80b8b224..897d40c5 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsList.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsList.java @@ -64,7 +64,7 @@ public class CmdFactionsList extends FCommand faction.getTag(fme), faction.getFPlayersWhereOnline(true).size(), faction.getFPlayers().size(), - faction.getLandRounded(), + faction.getLandCount(), faction.getPowerRounded(), faction.getPowerMaxRounded()) ); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java index 5c025894..a4a35ff1 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java @@ -61,12 +61,12 @@ public class CmdFactionsShow extends FCommand double powerBoost = faction.getPowerBoost(); String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")"; - msg("Land / Power / Maxpower: %d/%d/%d %s", faction.getLandRounded(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost); + msg("Land / Power / Maxpower: %d/%d/%d %s", faction.getLandCount(), faction.getPowerRounded(), faction.getPowerMaxRounded(), boost); // show the land value if (Econ.shouldBeUsed()) { - double value = Econ.calculateTotalLandValue(faction.getLandRounded()); + double value = Econ.calculateTotalLandValue(faction.getLandCount()); double refund = value * ConfServer.econClaimRefundMultiplier; if (value > 0) { diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java index 9c70d88f..7bd9fb23 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaim.java @@ -40,7 +40,7 @@ public class CmdFactionsUnclaim extends FCommand //String moneyBack = ""; if (Econ.shouldBeUsed()) { - double refund = Econ.calculateClaimRefund(myFaction.getLandRounded()); + double refund = Econ.calculateClaimRefund(myFaction.getLandCount()); if(ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts) { diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java index 587e0ef0..ee8d113b 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsUnclaimall.java @@ -28,7 +28,7 @@ public class CmdFactionsUnclaimall extends FCommand { if (Econ.shouldBeUsed()) { - double refund = Econ.calculateTotalLandRefund(myFaction.getLandRounded()); + double refund = Econ.calculateTotalLandRefund(myFaction.getLandCount()); if(ConfServer.bankEnabled && ConfServer.bankFactionPaysLandCosts) { if ( ! Econ.modifyMoney(myFaction, refund, "to unclaim all faction land", "for unclaiming all faction land")) return; diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index 6b89bb51..d1211fe3 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -66,7 +66,7 @@ public abstract class FCommand extends MCommand { if ( ! Econ.shouldBeUsed() || this.fme == null || cost == 0.0 || fme.isUsingAdminMode()) return true; - if(ConfServer.bankEnabled && ConfServer.bankFactionPaysCosts && fme.hasFaction()) + if (ConfServer.bankEnabled && ConfServer.bankFactionPaysCosts && fme.hasFaction()) return Econ.modifyMoney(myFaction, -cost, toDoThis, forDoingThis); else return Econ.modifyMoney(fme, -cost, toDoThis, forDoingThis); diff --git a/src/com/massivecraft/factions/integration/SpoutMainListener.java b/src/com/massivecraft/factions/integration/SpoutMainListener.java index 7d39ad73..e93086ee 100644 --- a/src/com/massivecraft/factions/integration/SpoutMainListener.java +++ b/src/com/massivecraft/factions/integration/SpoutMainListener.java @@ -113,8 +113,10 @@ public class SpoutMainListener implements Listener String msg = tag; - if (ConfServer.spoutTerritoryDisplayShowDescription && !factionHere.getDescription().isEmpty()) + if (ConfServer.spoutTerritoryDisplayShowDescription && factionHere.hasDescription()) + { msg += " - " + factionHere.getDescription(); + } label.setText(msg); alignLabel(label, msg); @@ -141,8 +143,10 @@ public class SpoutMainListener implements Listener String msg = tag; - if (ConfServer.spoutTerritoryNoticeShowDescription && !factionHere.getDescription().isEmpty()) + if (ConfServer.spoutTerritoryNoticeShowDescription && factionHere.hasDescription()) + { msg += " - " + factionHere.getDescription(); + } label.setText(msg); alignLabel(label, msg, 2);