Treat a move as a move instead of a despawn+spawn.

This commit is contained in:
Olof Larsson 2013-12-03 18:02:15 +01:00
parent 05aaa8140d
commit efa9d6cb59

View File

@ -133,30 +133,23 @@ public class Econ
} }
// Transfer money // Transfer money
if (Money.despawn(amount, null, from)) if (Money.move(amount, invoker, from, to))
{ {
if (Money.spawn(amount, null, to)) if (notify)
{ {
if (notify) sendTransferInfo(invoker, from, to, amount);
{
sendTransferInfo(invoker, from, to, amount);
}
return true;
}
else
{
// We failed. Try a rollback
Money.spawn(amount, null, from);
} }
return true;
} }
else
// 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(amount), to.describeTo(invoker), from.describeTo(invoker, true)); // if we get here something with the transaction failed
if (invoker != null && notify)
{
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;
} }
return false;
} }
public static Set<UPlayer> getUPlayers(EconomyParticipator ep) public static Set<UPlayer> getUPlayers(EconomyParticipator ep)