Package com.iCo8.system

Examples of com.iCo8.system.Accounts


public class players implements Listener {

    @EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Accounts accounts = new Accounts();
        Player player = event.getPlayer();

        if(player != null)
            if(!accounts.exists(player.getName()))
                accounts.create(player.getName());
    }
View Full Code Here


            Plugin ec = plugin.getServer().getPluginManager().getPlugin("iConomy");
            if (ec != null && ec.isEnabled() && ec.getClass().getName().equals("com.iCo6.iConomy")) {
                String version = ec.getDescription().getVersion().split("\\.")[0];
                name += version;
                economy = (iConomy) ec;
                accounts = new Accounts();
                log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), name));
            }
        }
    }
View Full Code Here

                Plugin ec = event.getPlugin();
                if (ec.getClass().getName().equals("com.iCo6.iConomy")) {
                    String version = ec.getDescription().getVersion().split("\\.")[0];
                    name += version;
                    economy.economy = (iConomy) ec;
                    accounts = new Accounts();
                    log.info(String.format("[%s][Economy] %s hooked.", plugin.getDescription().getName(), economy.name));
                }
            }
        }
View Full Code Here

        }
      }
    }
    else if(Bukkit.getPluginManager().getPlugin("iConomy") instanceof iConomy)
    {
      iConomyEcon = new Accounts();
     
      if(iConomyEcon != null)
        Bukkit.getLogger().fine("iConomy detected and connected, economy available.");
    }
   
View Full Code Here

    }

    @Override
    public double getBalance(String playerName) {
        this.checkExist(playerName);
        return new Accounts().get(playerName).getHoldings().getBalance();
    }
View Full Code Here

    }

    @Override
    public boolean add(String playerName, double amount) {
        this.checkExist(playerName);
        new Accounts().get(playerName).getHoldings().add(amount);
        return true;
    }
View Full Code Here

    @Override
    public boolean subtract(String playerName, double amount) {
        this.checkExist(playerName);
        if (this.canAfford(playerName, amount)) {
            new Accounts().get(playerName).getHoldings().subtract(amount);
            return true;
        }
        return false;
    }
View Full Code Here

    @Override
    public boolean transfer(String playerFrom, String playerTo, double amount) {
        this.checkExist(playerTo);
        this.checkExist(playerFrom);
        if (this.canAfford(playerFrom, amount)) {
            Account p1 = new Accounts().get(playerFrom);
            Account p2 = new Accounts().get(playerTo);
            p1.getHoldings().subtract(amount);
            p2.getHoldings().add(amount);
            return true;
        }
        return false;
View Full Code Here

        }
        return false;
    }

    private void checkExist(String playerName) {
        Accounts acc = new Accounts();
        if (!acc.exists(playerName)) {
            acc.create(playerName);
        }
    }
View Full Code Here

 
  public iConomy6Balance (ShowCaseStandalone scs, iConomy iconomy) {
//    super (scs);
    this.iconomy  = iconomy;
    this.scs    = scs;
    accounts     = new Accounts ();
  }
View Full Code Here

TOP

Related Classes of com.iCo8.system.Accounts

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.