From e45592432af141c1eca793ac29165e12369957a8 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 11 Apr 2013 11:44:55 +0200 Subject: [PATCH] rename getOpen --> isOpen and remove old money migration code. --- src/com/massivecraft/factions/Faction.java | 16 ++++++++-------- .../factions/cmd/CmdFactionsJoin.java | 2 +- .../factions/cmd/CmdFactionsOpen.java | 4 ++-- .../factions/cmd/CmdFactionsShow.java | 2 +- .../massivecraft/factions/integration/Econ.java | 17 ----------------- .../listeners/FactionsBlockListener.java | 7 +++++++ 6 files changed, 19 insertions(+), 29 deletions(-) diff --git a/src/com/massivecraft/factions/Faction.java b/src/com/massivecraft/factions/Faction.java index 4998d7e7..fba8e8df 100644 --- a/src/com/massivecraft/factions/Faction.java +++ b/src/com/massivecraft/factions/Faction.java @@ -34,8 +34,8 @@ public class Faction extends Entity implements EconomyParticipator // FIELD: open private boolean open; - public boolean getOpen() { return open; } - public void setOpen(boolean isOpen) { open = isOpen; } + public boolean isOpen() { return this.open; } + public void setOpen(boolean open) { this.open = open; } // FIELD: tag private String tag; @@ -84,16 +84,17 @@ public class Faction extends Entity implements EconomyParticipator // FIELD: account (fake field) // Bank functions - public double money; public String getAccountId() { - String aid = "faction-"+this.getId(); + String accountId = "faction-"+this.getId(); // We need to override the default money given to players. - if ( ! Econ.hasAccount(aid)) - Econ.setBalance(aid, 0); + if ( ! Econ.hasAccount(accountId)) + { + Econ.setBalance(accountId, 0); + } - return aid; + return accountId; } // FIELD: cape @@ -196,7 +197,6 @@ public class Faction extends Entity implements EconomyParticipator this.open = ConfServer.newFactionsDefaultOpen; this.tag = "???"; this.description = "Default faction description :("; - this.money = 0.0; this.powerBoost = 0.0; this.flagOverrides = new LinkedHashMap(); this.permOverrides = new LinkedHashMap>(); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java index bb5d4814..61d2f405 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsJoin.java @@ -68,7 +68,7 @@ public class CmdFactionsJoin extends FCommand return; } - if( ! (faction.getOpen() || faction.isInvited(fplayer) || fme.hasAdminMode() || Perm.JOIN_ANY.has(sender, false))) + if( ! (faction.isOpen() || faction.isInvited(fplayer) || fme.hasAdminMode() || Perm.JOIN_ANY.has(sender, false))) { msg("This faction requires invitation."); if (samePlayer) diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java index 5a74f5bf..578701da 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsOpen.java @@ -30,9 +30,9 @@ public class CmdFactionsOpen 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.econCostOpen, "to open or close the faction", "for opening or closing the faction")) return; - myFaction.setOpen(this.argAsBool(0, ! myFaction.getOpen())); + myFaction.setOpen(this.argAsBool(0, ! myFaction.isOpen())); - String open = myFaction.getOpen() ? "open" : "closed"; + String open = myFaction.isOpen() ? "open" : "closed"; // Inform myFaction.msg("%s changed the faction to %s.", fme.describeTo(myFaction, true), open); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java index b3741366..732508d6 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java @@ -66,7 +66,7 @@ public class CmdFactionsShow extends FCommand msg("This faction is peaceful - in truce with everyone."); } - msg("Joining: "+(faction.getOpen() ? "no invitation is needed" : "invitation is required")); + msg("Joining: "+(faction.isOpen() ? "no invitation is needed" : "invitation is required")); double powerBoost = faction.getPowerBoost(); String boost = (powerBoost == 0.0) ? "" : (powerBoost > 0.0 ? " (bonus: " : " (penalty: ") + powerBoost + ")"; diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index c1a32dd8..85c72760 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -11,7 +11,6 @@ import com.massivecraft.factions.ConfServer; import com.massivecraft.factions.FPerm; import com.massivecraft.factions.FPlayer; import com.massivecraft.factions.Faction; -import com.massivecraft.factions.FactionColl; import com.massivecraft.factions.Factions; import com.massivecraft.factions.iface.EconomyParticipator; import com.massivecraft.factions.util.RelationUtil; @@ -48,8 +47,6 @@ public class Econ if ( ! ConfServer.econEnabled) Factions.get().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); - - oldMoneyDoTransfer(); } public static boolean shouldBeUsed() @@ -294,20 +291,6 @@ public class Econ { return econ.format(amount); } - - public static void oldMoneyDoTransfer() - { - if ( ! shouldBeUsed()) return; - - for (Faction faction : FactionColl.i.get()) - { - if (faction.money > 0) - { - econ.depositPlayer(faction.getAccountId(), faction.money); - faction.money = 0; - } - } - } // calculate the cost for claiming land public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) diff --git a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java index eda10246..0cad1840 100644 --- a/src/com/massivecraft/factions/listeners/FactionsBlockListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsBlockListener.java @@ -29,6 +29,10 @@ import com.massivecraft.mcore.ps.PS; public class FactionsBlockListener implements Listener { + // -------------------------------------------- // + // FLAG: FIRE SPREAD + // -------------------------------------------- // + public void blockFireSpread(Block block, Cancellable cancellable) { // If the faction at the block has firespread disabled ... @@ -70,6 +74,9 @@ public class FactionsBlockListener implements Listener blockFireSpread(event.getBlock(), event); } + // -------------------------------------------- // + // ASSORTED + // -------------------------------------------- // public static boolean playerCanBuildDestroyBlock(Player player, Block block, String action, boolean justCheck) {