Exemple #1
0
  @Override
  public double getBalance(String player) {
    Account account = eco.getBank().getAccount(player);
    if (account == null) {
      eco.getBank().addAccount(player);
      account = eco.getBank().getAccount(player);
    }

    return account.getBalance();
  }
Exemple #2
0
  @Override
  public boolean deposit(String player, double amount) {
    if (amount > 0) {
      Account account = eco.getBank().getAccount(player);
      if (account == null) {
        eco.getBank().addAccount(player);
        account = eco.getBank().getAccount(player);
      }

      account.add(amount);
      return true;
    }
    return false;
  }
 private void hookDepends() {
   Plugin test = getServer().getPluginManager().getPlugin("iConomy");
   if (test != null) { // this.getServer().getPluginManager().isPluginEnabled("iConomy")) {
     iConomy = (iConomy) test; // this.getServer().getPluginManager().getPlugin("iConomy");
     iBank = iConomy.getBank();
     // config.currency = iBank.getCurrency();
     Log("Attached to iConomy.");
   } else {
     test = getServer().getPluginManager().getPlugin("BOSEconomy");
     if (test != null) {
       economy = (BOSEconomy) test;
       Log("Attached to BOSEconomy");
     } else {
       Log(Level.WARNING, "economy plugin not yet found...", false);
     }
   }
   test = getServer().getPluginManager().getPlugin("Permissions");
   if (test != null) { // this.getServer().getPluginManager().isPluginEnabled("Permissions")) {
     Permissions =
         (Permissions) test; // this.getServer().getPluginManager().getPlugin("Permissions");
     Log("Attached to Permissions.");
   }
   test = getServer().getPluginManager().getPlugin("MinecraftIM");
   if (test != null) { // this.getServer().getPluginManager().isPluginEnabled("MinecraftIM")) {
     messenger =
         (MinecraftIM) test; // this.getServer().getPluginManager().getPlugin("MinecraftIM");
     Log("linked to MinecraftIM");
   }
   // Log(Level.INFO, "Permissions not yet found...");
 }
Exemple #4
0
  @Override
  public boolean withdraw(String player, double amount) {
    if (amount > 0) {
      Account account = eco.getBank().getAccount(player);
      if (account == null) {
        eco.getBank().addAccount(player);
        account = eco.getBank().getAccount(player);
      }

      double balance = account.getBalance();
      if ((balance - amount) >= 0) {
        account.subtract(amount);
        return true;
      }
    }

    return false;
  }
Exemple #5
0
 public Method.MethodAccount getAccount(String name) {
   return new iCoAccount(iConomy.getBank().getAccount(name));
 }
Exemple #6
0
 public boolean hasAccount(String name) {
   return iConomy.getBank().hasAccount(name);
 }
Exemple #7
0
 public String format(double amount) {
   return iConomy.getBank().format(amount);
 }