MCore change related to universed money.

This commit is contained in:
Olof Larsson 2013-12-03 12:59:46 +01:00
parent 1a63c59c54
commit 20659b6086
9 changed files with 28 additions and 28 deletions

View File

@ -104,13 +104,13 @@ public class CmdFactionsFaction extends FCommand
money *= -1;
}
msg("<a>Total land %s %s: <i>%s", type.toString().toLowerCase(), word, Money.format(faction, money));
msg("<a>Total land %s %s: <i>%s", type.toString().toLowerCase(), word, Money.format(money));
}
// Show bank contents
if (UConf.get(faction).bankEnabled)
{
msg("<a>Bank contains: <i>"+Money.format(faction, Money.get(faction)));
msg("<a>Bank contains: <i>"+Money.format(Money.get(faction)));
}
}

View File

@ -53,7 +53,7 @@ public class CmdFactionsMoneyDeposit extends FCommand
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(usender, amount), faction.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s deposited %s in the faction bank: %s", usender.getName(), Money.format(amount), faction.describeTo(null))));
}
}

View File

@ -58,7 +58,7 @@ public class CmdFactionsMoneyTransferFf extends FCommand
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -60,7 +60,7 @@ public class CmdFactionsMoneyTransferFp extends FCommand
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the faction \"%s\" to the player \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -60,7 +60,7 @@ public class CmdFactionsMoneyTransferPf extends FCommand
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(from, amount), from.describeTo(null), to.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s transferred %s from the player \"%s\" to the faction \"%s\"", usender.getName(), Money.format(amount), from.describeTo(null), to.describeTo(null))));
}
}

View File

@ -57,7 +57,7 @@ public class CmdFactionsMoneyWithdraw extends FCommand
if (success && MConf.get().logMoneyTransactions)
{
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(from, amount), from.describeTo(null))));
Factions.get().log(ChatColor.stripColor(Txt.parse("%s withdrew %s from the faction bank: %s", usender.getName(), Money.format(amount), from.describeTo(null))));
}
}

View File

@ -60,7 +60,7 @@ public class Faction extends Entity<Faction> implements EconomyParticipator
@Override
public void preDetach(String id)
{
Money.set(this, 0);
Money.set(0, null, this);
String universe = this.getUniverse();

View File

@ -21,7 +21,7 @@ public class Econ
// TODO: Could we not have it enabled as long as Money.enabled is true?
public static boolean isEnabled(Object universe)
{
return UConf.get(universe).econEnabled && Money.enabled(universe);
return UConf.get(universe).econEnabled && Money.enabled();
}
// -------------------------------------------- //
@ -59,14 +59,14 @@ public class Econ
if (uconf.econUniverseAccount == null) return;
if (uconf.econUniverseAccount.length() == 0) return;
if (!Money.exists(universe, uconf.econUniverseAccount)) return;
if (!Money.exists(uconf.econUniverseAccount)) return;
Money.add(universe, uconf.econUniverseAccount, delta);
Money.spawn(delta, null, uconf.econUniverseAccount);
}
public static void sendBalanceInfo(UPlayer to, EconomyParticipator about)
{
to.msg("<a>%s's<i> balance is <h>%s<i>.", about.describeTo(to, true), Money.format(about, Money.get(about)));
to.msg("<a>%s's<i> balance is <h>%s<i>.", about.describeTo(to, true), Money.format(Money.get(about)));
}
public static boolean canIControllYou(EconomyParticipator i, EconomyParticipator you)
@ -127,15 +127,15 @@ public class Econ
// There was not enough money to pay
if (invoker != null && notify)
{
invoker.msg("<h>%s<b> can't afford to transfer <h>%s<b> to %s<b>.", from.describeTo(invoker, true), Money.format(from, amount), to.describeTo(invoker));
invoker.msg("<h>%s<b> can't afford to transfer <h>%s<b> to %s<b>.", from.describeTo(invoker, true), Money.format(amount), to.describeTo(invoker));
}
return false;
}
// Transfer money
if (Money.subtract(from, amount))
if (Money.despawn(amount, null, from))
{
if (Money.add(to, amount))
if (Money.spawn(amount, null, to))
{
if (notify)
{
@ -146,14 +146,14 @@ public class Econ
else
{
// We failed. Try a rollback
Money.add(from, amount);
Money.spawn(amount, null, from);
}
}
// if we get here something with the transaction failed
if (notify)
{
invoker.msg("Unable to transfer %s<b> to <h>%s<b> from <h>%s<b>.", Money.format(from, amount), to.describeTo(invoker), from.describeTo(invoker, true));
invoker.msg("Unable to transfer %s<b> to <h>%s<b> from <h>%s<b>.", Money.format(amount), to.describeTo(invoker), from.describeTo(invoker, true));
}
return false;
@ -190,28 +190,28 @@ public class Econ
{
for (UPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> was transfered from <h>%s<i> to <h>%s<i>.", Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient));
recipient.msg("<h>%s<i> was transfered from <h>%s<i> to <h>%s<i>.", Money.format(amount), from.describeTo(recipient), to.describeTo(recipient));
}
}
else if (invoker == from)
{
for (UPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> <h>gave %s<i> to <h>%s<i>.", from.describeTo(recipient, true), Money.format(from, amount), to.describeTo(recipient));
recipient.msg("<h>%s<i> <h>gave %s<i> to <h>%s<i>.", from.describeTo(recipient, true), Money.format(amount), to.describeTo(recipient));
}
}
else if (invoker == to)
{
for (UPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> <h>took %s<i> from <h>%s<i>.", to.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient));
recipient.msg("<h>%s<i> <h>took %s<i> from <h>%s<i>.", to.describeTo(recipient, true), Money.format(amount), from.describeTo(recipient));
}
}
else
{
for (UPlayer recipient : recipients)
{
recipient.msg("<h>%s<i> transfered <h>%s<i> from <h>%s<i> to <h>%s<i>.", invoker.describeTo(recipient, true), Money.format(from, amount), from.describeTo(recipient), to.describeTo(recipient));
recipient.msg("<h>%s<i> transfered <h>%s<i> from <h>%s<i> to <h>%s<i>.", invoker.describeTo(recipient, true), Money.format(amount), from.describeTo(recipient), to.describeTo(recipient));
}
}
}
@ -224,7 +224,7 @@ public class Econ
{
if (toDoThis != null && !toDoThis.isEmpty())
{
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", ep.describeTo(ep, true), Money.format(ep, delta), toDoThis);
ep.msg("<h>%s<i> can't afford <h>%s<i> %s.", ep.describeTo(ep, true), Money.format(delta), toDoThis);
}
return false;
}
@ -240,7 +240,7 @@ public class Econ
boolean hasActionDesctription = (actionDescription != null && !actionDescription.isEmpty());
if (Money.add(ep, delta))
if (Money.spawn(delta, null, ep))
{
modifyUniverseMoney(ep, -delta);
@ -248,11 +248,11 @@ public class Econ
{
if (delta > 0)
{
ep.msg("<h>%s<i> gained <h>%s<i> since did %s.", You, Money.format(ep, delta), actionDescription);
ep.msg("<h>%s<i> gained <h>%s<i> since did %s.", You, Money.format(delta), actionDescription);
}
else
{
ep.msg("<h>%s<i> lost <h>%s<i> since did %s.", You, Money.format(ep, -delta), actionDescription);
ep.msg("<h>%s<i> lost <h>%s<i> since did %s.", You, Money.format(-delta), actionDescription);
}
}
return true;
@ -263,11 +263,11 @@ public class Econ
{
if (delta > 0)
{
ep.msg("<h>%s<i> would have gained <h>%s<i> since did %s, but the deposit failed.", You, Money.format(ep, delta), actionDescription);
ep.msg("<h>%s<i> would have gained <h>%s<i> since did %s, but the deposit failed.", You, Money.format(delta), actionDescription);
}
else
{
ep.msg("<h>%s<i> can't afford <h>%s<i> to %s.", You, Money.format(ep, -delta), actionDescription);
ep.msg("<h>%s<i> can't afford <h>%s<i> to %s.", You, Money.format(-delta), actionDescription);
}
}
return false;

View File

@ -83,7 +83,7 @@ public class FactionsListenerEcon implements Listener
Faction faction = event.getFaction();
double amount = Money.get(faction);
String amountString = Money.format(faction, amount);
String amountString = Money.format(amount);
Econ.transferMoney(usender, faction, usender, amount, true);