Package com.gmail.mirelatrue.xpbank

Examples of com.gmail.mirelatrue.xpbank.GroupBank


        return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
    }

    @Override
    public EconomyResponse createBank (String name, String player) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank != null) {
            return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("GroupBankExists"), name));
        }

        Account account = api.getAccount(player);

        groupBank = api.createGroupBank(name, account);

        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
    }
View Full Code Here


        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
    }

    @Override
    public EconomyResponse deleteBank (String name) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
        }

        api.deleteGroupBank(groupBank, String.format(api.getMsg("Disbanded"), groupBank.getName()));

        return new EconomyResponse(0, 0, ResponseType.SUCCESS, null);
    }
View Full Code Here

        return new EconomyResponse(0, 0, ResponseType.SUCCESS, null);
    }

    @Override
    public EconomyResponse bankBalance (String name) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
        }

        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
    }
View Full Code Here

        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
    }

    @Override
    public EconomyResponse bankHas (String name, double amount) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
        }

        int value = (int) amount;
        int balance = groupBank.getBalance();

        if (balance >= value) {
            return new EconomyResponse(0, balance, ResponseType.SUCCESS, null);
        }
View Full Code Here

        return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format(api.getMsg("InsufficientXP"), api.currencyName(value)));
    }

    @Override
    public EconomyResponse bankWithdraw (String name, double amount) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
        }

        int value = (int) amount;
        int balance = groupBank.getBalance();

        if (value < 1) {
            return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
        }

        if (value > balance) {
            return new EconomyResponse(0, balance, ResponseType.FAILURE, String.format(api.getMsg("InsufficientXP"), api.currencyName(value)));
        }

        groupBank.modifyBalance(-value);

        return new EconomyResponse(value, balance - value, ResponseType.SUCCESS, null);
    }
View Full Code Here

        return new EconomyResponse(value, balance - value, ResponseType.SUCCESS, null);
    }

    @Override
    public EconomyResponse bankDeposit (String name, double amount) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
        }

        int value = (int) amount;
        int balance = groupBank.getBalance();

        if (value < 1) {
            return new EconomyResponse(0, balance, ResponseType.FAILURE, api.getMsg("LessThanZero"));
        }

        groupBank.modifyBalance(value);

        return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
    }
View Full Code Here

        return new EconomyResponse(value, balance + value, ResponseType.SUCCESS, null);
    }

    @Override
    public EconomyResponse isBankOwner (String name, String playerName) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
        }

        Account account = api.getAccount(name);

        if (account == null) {
            return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, api.getMsg("PlayerNotExist"));
        }

        if (groupBank.getOwner().equalsIgnoreCase(name)) {
            return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
        }

        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("PlayerNotOwner"), account.getName(), groupBank.getName()));
    }
View Full Code Here

        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("PlayerNotOwner"), account.getName(), groupBank.getName()));
    }

    @Override
    public EconomyResponse isBankMember (String name, String playerName) {
        GroupBank groupBank = api.getGroupBank(name);

        if (groupBank == null) {
            return new EconomyResponse(0, 0, ResponseType.FAILURE, api.getMsg("GroupBankNotExists"));
        }

        Account account = api.getAccount(name);

        if (account == null) {
            return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, api.getMsg("PlayerNotExist"));
        }

        if (groupBank.groupMembers.getMembers().containsKey(playerName)) {
            return new EconomyResponse(0, groupBank.getBalance(), ResponseType.SUCCESS, null);
        }

        return new EconomyResponse(0, groupBank.getBalance(), ResponseType.FAILURE, String.format(api.getMsg("NotAMemberOf"), groupBank.getName(), account.getName()));
    }
View Full Code Here

TOP

Related Classes of com.gmail.mirelatrue.xpbank.GroupBank

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.