[Breaking] Add exception when players have exceeded their account limit.

This might effect some plugins which hook Essentials for economy without using the API
This commit is contained in:
KHobbits 2014-02-02 16:07:32 +00:00
parent 161862bc53
commit 882ebae257
38 changed files with 151 additions and 83 deletions

View file

@ -2,9 +2,11 @@ package com.earth2me.essentials.commands;
import com.earth2me.essentials.ChargeException;
import com.earth2me.essentials.CommandSource;
import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.Trade;
import com.earth2me.essentials.User;
import java.math.BigDecimal;
import net.ess3.api.MaxMoneyException;
import org.bukkit.Server;
@ -33,7 +35,14 @@ public class Commandpay extends EssentialsLoopCommand
protected void updatePlayer(final Server server, final CommandSource sender, final User player, final String[] args) throws ChargeException
{
User user = ess.getUser(sender.getPlayer());
user.payUser(player, amount);
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess);
try
{
user.payUser(player, amount);
Trade.log("Command", "Pay", "Player", user.getName(), new Trade(amount, ess), player.getName(), new Trade(amount, ess), user.getLocation(), ess);
}
catch (MaxMoneyException ex)
{
sender.sendMessage(_("maxMoney"));
}
}
}