Esempio n. 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();
  }
Esempio n. 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;
  }
Esempio n. 3
0
 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...");
 }
Esempio n. 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;
  }
Esempio n. 5
0
 public Method.MethodAccount getAccount(String name) {
   return new iCoAccount(iConomy.getBank().getAccount(name));
 }
Esempio n. 6
0
 public boolean hasAccount(String name) {
   return iConomy.getBank().hasAccount(name);
 }
Esempio n. 7
0
 public String format(double amount) {
   return iConomy.getBank().format(amount);
 }