Examples of AccountContext


Examples of is.currency.syst.AccountContext

        return currency.getCurrencyConfig().getCurrencyMajor().get(0);
    }

    @Override
    public double getBalance(String playerName) {
        AccountContext account = this.currency.getAccountManager().getAccount(playerName);
        if (account == null) {
            return 0.0;    
        }

        return account.getBalance();
    }
View Full Code Here

Examples of is.currency.syst.AccountContext

        return account.getBalance();
    }

    @Override
    public boolean has(String playerName, double amount) {
        AccountContext account = this.currency.getAccountManager().getAccount(playerName);
        if (account == null) {
            return false;
        } else {
            return account.hasBalance(amount);
        }
    }
View Full Code Here

Examples of is.currency.syst.AccountContext

    public EconomyResponse withdrawPlayer(String playerName, double amount) {
        if (amount < 0) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds");
        }

        AccountContext account = this.currency.getAccountManager().getAccount(playerName);
        if (account == null) {
            return new EconomyResponse(0.0, 0.0, ResponseType.FAILURE, "That account does not exist");
        } else if (!account.hasBalance(amount)) {
            return new EconomyResponse(0.0, account.getBalance(), ResponseType.FAILURE, "Insufficient funds")
        } else {
            account.subtractBalance(amount);
            return new EconomyResponse(amount, account.getBalance(), ResponseType.SUCCESS, "");
        }
    }
View Full Code Here

Examples of is.currency.syst.AccountContext

    public EconomyResponse depositPlayer(String playerName, double amount) {
        if (amount < 0) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds");
        }

        AccountContext account = this.currency.getAccountManager().getAccount(playerName);
        if (account == null) {
            return new EconomyResponse(0.0, 0.0, ResponseType.FAILURE, "That account does not exist");
        }  
        account.addBalance(amount);
        return new EconomyResponse(amount, account.getBalance(), ResponseType.SUCCESS, "");
    }
View Full Code Here

Examples of is.currency.syst.AccountContext

        return new EconomyResponse(0, 0, ResponseType.FAILURE, "That account does not exist!");
    }

    @Override
    public EconomyResponse bankBalance(String name) {
        AccountContext account = this.currency.getAccountManager().getAccount(name);

        if (account == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "That account does not exists.");
        }
        return new EconomyResponse(0, account.getBalance(), ResponseType.SUCCESS, "");
    }
View Full Code Here

Examples of is.currency.syst.AccountContext

        return new EconomyResponse(0, account.getBalance(), ResponseType.SUCCESS, "");
    }

    @Override
    public EconomyResponse bankHas(String name, double amount) {
        AccountContext account = this.currency.getAccountManager().getAccount(name);
        if (account == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "That account does not exist!");
        } else if (!account.hasBalance(amount)) {
            return new EconomyResponse(0, account.getBalance(), ResponseType.FAILURE, "That account does not have enough!");
        } else {
            return new EconomyResponse(0, account.getBalance(), ResponseType.SUCCESS, "");
        }
    }
View Full Code Here

Examples of is.currency.syst.AccountContext

    public EconomyResponse bankWithdraw(String name, double amount) {
        if (amount < 0) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot withdraw negative funds");
        }

        AccountContext account = this.currency.getAccountManager().getAccount(name);
        if (account == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "That account does not exist!");
        } else if (!account.hasBalance(amount)) {
            return new EconomyResponse(0, account.getBalance(), ResponseType.FAILURE, "That account does not have enough!");
        } else {
            account.subtractBalance(amount);
            return new EconomyResponse(amount, account.getBalance(), ResponseType.SUCCESS, "");
        }
    }
View Full Code Here

Examples of is.currency.syst.AccountContext

    public EconomyResponse bankDeposit(String name, double amount) {
        if (amount < 0) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "Cannot desposit negative funds");
        }

        AccountContext account = this.currency.getAccountManager().getAccount(name);
        if (account == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, "That account does not exist!");
        } else {
            account.addBalance(amount);
            return new EconomyResponse(amount, account.getBalance(), ResponseType.SUCCESS, "");
        }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.