Package org.melonbrew.fe.database

Examples of org.melonbrew.fe.database.Account


            money = Double.parseDouble(args[1]);
        } catch (NumberFormatException e) {
            return false;
        }

        Account victim = plugin.getShortenedAccount(args[0]);

        if (victim == null) {
            Phrase.ACCOUNT_DOES_NOT_EXIST.sendWithPrefix(sender);
            return true;
        }

        String formattedMoney = plugin.getAPI().format(money);

        victim.withdraw(money);

        Phrase.PLAYER_DEDUCT_MONEY.sendWithPrefix(sender, formattedMoney, victim.getName());

        Player receiverPlayer = plugin.getServer().getPlayerExact(victim.getName());

        if (receiverPlayer != null) {
            Phrase.PLAYER_DEDUCTED_MONEY.sendWithPrefix(receiverPlayer, formattedMoney, sender.getName());
        }
View Full Code Here


            money = Double.parseDouble(args[1]);
        } catch (NumberFormatException e) {
            return false;
        }

        Account victim = plugin.getShortenedAccount(args[0]);

        if (victim == null) {
            Phrase.ACCOUNT_DOES_NOT_EXIST.sendWithPrefix(sender);
            return true;
        }

        if (!victim.canReceive(money)) {
            Phrase.MAX_BALANCE_REACHED.sendWithPrefix(sender, victim.getName());
            return true;
        }

        String formattedMoney = plugin.getAPI().format(money);

        victim.deposit(money);

        Phrase.PLAYER_GRANT_MONEY.sendWithPrefix(sender, formattedMoney, victim.getName());

        Player receiverPlayer = plugin.getServer().getPlayerExact(victim.getName());

        if (receiverPlayer != null) {
            Phrase.PLAYER_GRANTED_MONEY.sendWithPrefix(receiverPlayer, formattedMoney, sender.getName());
        }
View Full Code Here

            money = Double.parseDouble(args[1]);
        } catch (NumberFormatException e) {
            return false;
        }

        Account victim = plugin.getShortenedAccount(args[0]);

        if (victim == null) {
            Phrase.ACCOUNT_DOES_NOT_EXIST.sendWithPrefix(sender);
            return true;
        }

        if (!victim.canReceive(money)) {
            Phrase.MAX_BALANCE_REACHED.sendWithPrefix(sender, victim.getName());
            return true;
        }

        String formattedMoney = plugin.getAPI().format(money);

        victim.setMoney(money);

        Phrase.PLAYER_SET_MONEY.sendWithPrefix(sender, victim.getName(), formattedMoney);

        return true;
    }
View Full Code Here

        this.plugin = plugin;
    }

    public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) {
        Account account;

        if (args.length > 0 && sender.hasPermission("fe.balance.other")) {
            account = plugin.getShortenedAccount(args[0]);

            if (account == null) {
                Phrase.ACCOUNT_DOES_NOT_EXIST.sendWithPrefix(sender);

                return true;
            }

            Phrase.ACCOUNT_HAS.sendWithPrefix(sender, account.getName(), plugin.getAPI().format(account));
        } else {
            Player player = plugin.getServer().getPlayer(sender.getName());

            account = plugin.getAPI().getAccount(sender.getName(), player != null ? player.getUniqueId().toString() : null);
View Full Code Here

            Phrase.NAME_TOO_LONG.sendWithPrefix(sender);

            return true;
        }

        Account account = plugin.getAPI().createAccount(name, null);

        Phrase.ACCOUNT_CREATED.sendWithPrefix(sender, Phrase.PRIMARY_COLOR.parse() + account.getName() + Phrase.SECONDARY_COLOR.parse());

        return true;
    }
View Full Code Here

        }

        sender.sendMessage(plugin.getEqualMessage(Phrase.RICH.parse(), 10));

        for (int i = 0; i < topAccounts.size(); i++) {
            Account account = topAccounts.get(i);

            String two = Phrase.SECONDARY_COLOR.parse();

            sender.sendMessage(two + (i + 1) + ". " + Phrase.PRIMARY_COLOR.parse() + account.getName() + two + " - " + plugin.getAPI().format(account));
        }

        sender.sendMessage(plugin.getEndEqualMessage(28));

        return true;
View Full Code Here

        List<Account> topAccounts = new ArrayList<Account>();

        for (DBObject aCursor : cursor) {
            BasicDBObject topAccountObject = (BasicDBObject) aCursor;

            Account account = new Account(plugin, topAccountObject.getString("name"), topAccountObject.getString("uuid"), this);

            account.setMoney(topAccountObject.getDouble("money"));

            topAccounts.add(account);
        }

        return topAccounts;
View Full Code Here

        List<Account> accounts = new ArrayList<Account>();

        for (DBObject aCursor : cursor) {
            BasicDBObject accountObject = (BasicDBObject) aCursor;

            Account account = new Account(plugin, accountObject.getString("name"), accountObject.getString("uuid"), this);

            account.setMoney(accountObject.getDouble("money"));

            accounts.add(account);
        }

        return accounts;
View Full Code Here

        if (money <= 0.0) {
            return false;
        }

        Account receiver = plugin.getShortenedAccount(args[0]);

        if (receiver == null) {
            Phrase.ACCOUNT_DOES_NOT_EXIST.sendWithPrefix(sender);

            return true;
        }

        Account account = plugin.getAPI().getAccount(sender.getName(), null);

        if (!account.has(money)) {
            Phrase.NOT_ENOUGH_MONEY.sendWithPrefix(sender);

            return true;
        }

        if (!receiver.canReceive(money)) {
            Phrase.MAX_BALANCE_REACHED.sendWithPrefix(sender, receiver.getName());

            return true;
        }

        String formattedMoney = plugin.getAPI().format(money);

        account.withdraw(money);

        receiver.deposit(money);

        Phrase.MONEY_SENT.sendWithPrefix(sender, formattedMoney, receiver.getName());
View Full Code Here

        try {
            ResultSet set = connection.createStatement().executeQuery(sql);

            while (set.next()) {
                Account account = new Account(plugin, set.getString(accountsColumnUser), set.getString(accountsColumnUUID), this);

                account.setMoney(set.getDouble(accountsColumnMoney));

                topAccounts.add(account);
            }
        } catch (SQLException e) {
            e.printStackTrace();
View Full Code Here

TOP

Related Classes of org.melonbrew.fe.database.Account

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.