From 2299949a4a4bb7e41e2d7fa7a31e1f5b84283c49 Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Fri, 19 Apr 2013 15:32:16 +0200 Subject: [PATCH] Fix a couple of old cases where it said Admin instead of Leader. --- src/com/massivecraft/factions/FPlayer.java | 2 +- .../factions/cmd/CmdFactionsDisband.java | 2 +- .../factions/cmd/CmdFactionsLeader.java | 2 +- .../factions/cmd/CmdFactionsShow.java | 4 +- .../massivecraft/factions/cmd/FCommand.java | 2 +- .../factions/integration/Econ.java | 38 +++++++++++-------- 6 files changed, 29 insertions(+), 21 deletions(-) diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index 966af9a5..17a7121a 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -686,7 +686,7 @@ public class FPlayer extends SenderEntity implements EconomyParticipato if (!permanent && this.getRole() == Rel.LEADER && myFaction.getFPlayers().size() > 1) { - msg("You must give the admin role to someone else first."); + msg("You must give the leader role to someone else first."); return; } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java index 518b98fb..a3157490 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsDisband.java @@ -62,7 +62,7 @@ public class CmdFactionsDisband extends FCommand // Inform all players for (FPlayer fplayer : FPlayerColl.get().getAllOnline()) { - String who = senderIsConsole ? "A server admin" : fme.describeTo(fplayer); + String who = fme.describeTo(fplayer); if (fplayer.getFaction() == faction) { fplayer.msg("%s disbanded your faction.", who); diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java index 3fa6e416..d6cedfdc 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsLeader.java @@ -76,7 +76,7 @@ public class CmdFactionsLeader extends FCommand { targetFaction.promoteNewLeader(); msg("You have demoted %s from the position of faction leader.", newLeader.describeTo(fme, true)); - newLeader.msg("You have been demoted from the position of faction leader by %s.", senderIsConsole ? "a server admin" : fme.describeTo(newLeader, true)); + newLeader.msg("You have been demoted from the position of faction leader by %s.", fme.describeTo(newLeader, true)); return; } diff --git a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java index 3db0ff54..7f0db8e7 100644 --- a/src/com/massivecraft/factions/cmd/CmdFactionsShow.java +++ b/src/com/massivecraft/factions/cmd/CmdFactionsShow.java @@ -34,7 +34,7 @@ public class CmdFactionsShow extends FCommand Faction faction = this.arg(0, ARFaction.get(), myFaction); if (faction == null) return; - Collection admins = faction.getFPlayersWhereRole(Rel.LEADER); + Collection leaders = faction.getFPlayersWhereRole(Rel.LEADER); Collection mods = faction.getFPlayersWhereRole(Rel.OFFICER); Collection normals = faction.getFPlayersWhereRole(Rel.MEMBER); Collection recruits = faction.getFPlayersWhereRole(Rel.RECRUIT); @@ -100,7 +100,7 @@ public class CmdFactionsShow extends FCommand List memberOnlineNames = new ArrayList(); List memberOfflineNames = new ArrayList(); - for (FPlayer follower : admins) + for (FPlayer follower : leaders) { if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) { diff --git a/src/com/massivecraft/factions/cmd/FCommand.java b/src/com/massivecraft/factions/cmd/FCommand.java index 4f21b107..a4e16a53 100644 --- a/src/com/massivecraft/factions/cmd/FCommand.java +++ b/src/com/massivecraft/factions/cmd/FCommand.java @@ -38,7 +38,7 @@ public abstract class FCommand extends MCommand if (you.getRole().equals(Rel.LEADER)) { - i.sendMessage(Txt.parse("Only the faction admin can do that.")); + i.sendMessage(Txt.parse("Only the faction leader can do that.")); } else if (i.getRole().equals(Rel.OFFICER)) { diff --git a/src/com/massivecraft/factions/integration/Econ.java b/src/com/massivecraft/factions/integration/Econ.java index 271ed301..6641d1e8 100644 --- a/src/com/massivecraft/factions/integration/Econ.java +++ b/src/com/massivecraft/factions/integration/Econ.java @@ -47,8 +47,10 @@ public class Econ Factions.get().log("Economy integration through Vault plugin successful."); - if ( ! ConfServer.econEnabled) + if (!ConfServer.econEnabled) + { Factions.get().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true"); + } } // -------------------------------------------- // @@ -333,12 +335,6 @@ public class Econ } } - // format money string based on server's set currency type, like "24 gold" or "$24.50" - public static String moneyString(double amount) - { - return economy.format(amount); - } - // calculate the cost for claiming land public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) { @@ -377,6 +373,12 @@ public class Econ // Standard account management methods // -------------------------------------------- // + // format money string based on server's set currency type, like "24 gold" or "$24.50" + public static String moneyString(double amount) + { + return economy.format(amount); + } + public static boolean hasAccount(String name) { return economy.hasAccount(name); @@ -390,27 +392,33 @@ public class Econ public static boolean setBalance(String account, double amount) { double current = economy.getBalance(account); - if (current > amount) - return economy.withdrawPlayer(account, current - amount).transactionSuccess(); - else - return economy.depositPlayer(account, amount - current).transactionSuccess(); + + // TODO: WHY? + return modifyBalance(account, amount - current); } + public static boolean modifyBalance(String account, double amount) { - if (amount < 0) - return economy.withdrawPlayer(account, -amount).transactionSuccess(); - else - return economy.depositPlayer(account, amount).transactionSuccess(); + // TODO: Get rid of? + return deposit(account, amount); } public static boolean deposit(String account, double amount) { + if (amount < 0) + { + return withdraw(account, -amount); + } return economy.depositPlayer(account, amount).transactionSuccess(); } public static boolean withdraw(String account, double amount) { + if (amount < 0) + { + return deposit(account, -amount); + } return economy.withdrawPlayer(account, amount).transactionSuccess(); } }