Fix a couple of old cases where it said Admin instead of Leader.

This commit is contained in:
Olof Larsson 2013-04-19 15:32:16 +02:00
parent c2063a47b2
commit 2299949a4a
6 changed files with 29 additions and 21 deletions

View File

@ -686,7 +686,7 @@ public class FPlayer extends SenderEntity<FPlayer> implements EconomyParticipato
if (!permanent && this.getRole() == Rel.LEADER && myFaction.getFPlayers().size() > 1) if (!permanent && this.getRole() == Rel.LEADER && myFaction.getFPlayers().size() > 1)
{ {
msg("<b>You must give the admin role to someone else first."); msg("<b>You must give the leader role to someone else first.");
return; return;
} }

View File

@ -62,7 +62,7 @@ public class CmdFactionsDisband extends FCommand
// Inform all players // Inform all players
for (FPlayer fplayer : FPlayerColl.get().getAllOnline()) for (FPlayer fplayer : FPlayerColl.get().getAllOnline())
{ {
String who = senderIsConsole ? "A server admin" : fme.describeTo(fplayer); String who = fme.describeTo(fplayer);
if (fplayer.getFaction() == faction) if (fplayer.getFaction() == faction)
{ {
fplayer.msg("<h>%s<i> disbanded your faction.", who); fplayer.msg("<h>%s<i> disbanded your faction.", who);

View File

@ -76,7 +76,7 @@ public class CmdFactionsLeader extends FCommand
{ {
targetFaction.promoteNewLeader(); targetFaction.promoteNewLeader();
msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(fme, true)); msg("<i>You have demoted %s<i> from the position of faction leader.", newLeader.describeTo(fme, true));
newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", senderIsConsole ? "a server admin" : fme.describeTo(newLeader, true)); newLeader.msg("<i>You have been demoted from the position of faction leader by %s<i>.", fme.describeTo(newLeader, true));
return; return;
} }

View File

@ -34,7 +34,7 @@ public class CmdFactionsShow extends FCommand
Faction faction = this.arg(0, ARFaction.get(), myFaction); Faction faction = this.arg(0, ARFaction.get(), myFaction);
if (faction == null) return; if (faction == null) return;
Collection<FPlayer> admins = faction.getFPlayersWhereRole(Rel.LEADER); Collection<FPlayer> leaders = faction.getFPlayersWhereRole(Rel.LEADER);
Collection<FPlayer> mods = faction.getFPlayersWhereRole(Rel.OFFICER); Collection<FPlayer> mods = faction.getFPlayersWhereRole(Rel.OFFICER);
Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER); Collection<FPlayer> normals = faction.getFPlayersWhereRole(Rel.MEMBER);
Collection<FPlayer> recruits = faction.getFPlayersWhereRole(Rel.RECRUIT); Collection<FPlayer> recruits = faction.getFPlayersWhereRole(Rel.RECRUIT);
@ -100,7 +100,7 @@ public class CmdFactionsShow extends FCommand
List<String> memberOnlineNames = new ArrayList<String>(); List<String> memberOnlineNames = new ArrayList<String>();
List<String> memberOfflineNames = new ArrayList<String>(); List<String> memberOfflineNames = new ArrayList<String>();
for (FPlayer follower : admins) for (FPlayer follower : leaders)
{ {
if (follower.isOnline() && Mixin.isVisible(me, follower.getId())) if (follower.isOnline() && Mixin.isVisible(me, follower.getId()))
{ {

View File

@ -38,7 +38,7 @@ public abstract class FCommand extends MCommand
if (you.getRole().equals(Rel.LEADER)) if (you.getRole().equals(Rel.LEADER))
{ {
i.sendMessage(Txt.parse("<b>Only the faction admin can do that.")); i.sendMessage(Txt.parse("<b>Only the faction leader can do that."));
} }
else if (i.getRole().equals(Rel.OFFICER)) else if (i.getRole().equals(Rel.OFFICER))
{ {

View File

@ -48,8 +48,10 @@ public class Econ
Factions.get().log("Economy integration through Vault plugin successful."); 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"); Factions.get().log("NOTE: Economy is disabled. You can enable it with the command: f config econEnabled true");
} }
}
// -------------------------------------------- // // -------------------------------------------- //
// FIELDS // FIELDS
@ -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 // calculate the cost for claiming land
public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction) public static double calculateClaimCost(int ownedLand, boolean takingFromAnotherFaction)
{ {
@ -377,6 +373,12 @@ public class Econ
// Standard account management methods // 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) public static boolean hasAccount(String name)
{ {
return economy.hasAccount(name); return economy.hasAccount(name);
@ -390,27 +392,33 @@ public class Econ
public static boolean setBalance(String account, double amount) public static boolean setBalance(String account, double amount)
{ {
double current = economy.getBalance(account); double current = economy.getBalance(account);
if (current > amount)
return economy.withdrawPlayer(account, current - amount).transactionSuccess(); // TODO: WHY?
else return modifyBalance(account, amount - current);
return economy.depositPlayer(account, amount - current).transactionSuccess();
} }
public static boolean modifyBalance(String account, double amount) public static boolean modifyBalance(String account, double amount)
{ {
if (amount < 0) // TODO: Get rid of?
return economy.withdrawPlayer(account, -amount).transactionSuccess(); return deposit(account, amount);
else
return economy.depositPlayer(account, amount).transactionSuccess();
} }
public static boolean deposit(String account, double amount) public static boolean deposit(String account, double amount)
{ {
if (amount < 0)
{
return withdraw(account, -amount);
}
return economy.depositPlayer(account, amount).transactionSuccess(); return economy.depositPlayer(account, amount).transactionSuccess();
} }
public static boolean withdraw(String account, double amount) public static boolean withdraw(String account, double amount)
{ {
if (amount < 0)
{
return deposit(account, -amount);
}
return economy.withdrawPlayer(account, amount).transactionSuccess(); return economy.withdrawPlayer(account, amount).transactionSuccess();
} }
} }