Exemplo n.º 1
0
 @Override
 public void setMoney(final BigDecimal value) throws MaxMoneyException {
   if (ess.getSettings().isEcoDisabled()) {
     if (ess.getSettings().isDebug()) {
       ess.getLogger().info("Internal economy functions disabled, aborting balance change.");
     }
     return;
   }
   final BigDecimal oldBalance = _getMoney();
   if (Methods.hasMethod()) {
     try {
       final Method method = Methods.getMethod();
       if (!method.hasAccount(this.getName())) {
         throw new Exception();
       }
       final Method.MethodAccount account = Methods.getMethod().getAccount(this.getName());
       account.set(value.doubleValue());
     } catch (Exception ex) {
     }
   }
   super.setMoney(value, true);
   ess.getServer()
       .getPluginManager()
       .callEvent(new UserBalanceUpdateEvent(this.getBase(), oldBalance, value));
   Trade.log("Update", "Set", "API", getName(), new Trade(value, ess), null, null, null, ess);
 }
Exemplo n.º 2
0
 public void updateMoneyCache(final BigDecimal value) {
   if (ess.getSettings().isEcoDisabled()) {
     return;
   }
   if (Methods.hasMethod() && super.getMoney() != value) {
     try {
       super.setMoney(value, false);
     } catch (MaxMoneyException ex) {
       // We don't want to throw any errors here, just updating a cache
     }
   }
 }
Exemplo n.º 3
0
 @Override
 public void setMoney(final double value) {
   if (ess.getPaymentMethod().hasMethod()) {
     try {
       final Method method = ess.getPaymentMethod().getMethod();
       if (!method.hasAccount(this.getName())) {
         throw new Exception();
       }
       final Method.MethodAccount account =
           ess.getPaymentMethod().getMethod().getAccount(this.getName());
       account.set(value);
     } catch (Throwable ex) {
     }
   }
   super.setMoney(value);
 }