Package com.iCo6.handlers

Examples of com.iCo6.handlers.Give


       
        return (new Accounts()).create(name, balance);
    }

    public MethodAccount getAccount(String name) {
        return new iCoAccount((new Accounts()).get(name));
    }
View Full Code Here


            Messaging.send(sender, tag + template.parse());
            return false;
        }

        Account holder = new Account(from.getName());
        Holdings holdings = holder.getHoldings();

        if(holdings.getBalance() < amount) {
            template.set(Template.Node.ERROR_FUNDS);
            Messaging.send(sender, tag + template.parse());
            return false;
        }

        Account account = new Account(name);
        holdings.subtract(amount);
        account.getHoldings().add(amount);

        template.set(Template.Node.PAYMENT_TO);
        template.add("name", name);
        template.add("amount", iConomy.format(amount));
View Full Code Here

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

        Holdings holdings = accounts.get(playerName).getHoldings();
        if (holdings.hasEnough(amount)) {
            holdings.subtract(amount);
            return new EconomyResponse(amount, holdings.getBalance(), ResponseType.SUCCESS, null);
        } else {
            return new EconomyResponse(0, holdings.getBalance(), ResponseType.FAILURE, "Insufficient funds");
        }
    }
View Full Code Here

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

        Holdings holdings = accounts.get(playerName).getHoldings();
        holdings.add(amount);
        return new EconomyResponse(amount, holdings.getBalance(), ResponseType.SUCCESS, null);
    }
View Full Code Here

            Thrun.init(new Runnable() {
                public void run() {
                    long time = Constants.Nodes.InterestTime.getLong() * 1000L;

                    Interest = new Timer();
                    Interest.scheduleAtFixedRate(new Interest(getDataFolder().getPath()), time, time);
                }
            });
        }

        if(Constants.Nodes.Purging.getBoolean()) {
View Full Code Here

    public boolean hasUnder(double amount) {
        return amount > this.getBalance();
    }

    private void math(double amount, double balance, double ending) {
        HoldingsUpdate Event = new HoldingsUpdate(this.name, balance, ending, amount);
        iConomy.Server.getPluginManager().callEvent(Event);

        if(!Event.isCancelled())
            setBalance(ending);
    }
View Full Code Here

            // Setup Configuration
            Constants.load(new File(directory, "Config.yml"));

            // Setup Template
            Template = new Template(directory.getPath(), "Template.yml");

            // Upgrade Template to 6.0.9b
            LinkedHashMap<String, String> nodes = new LinkedHashMap<String, String>();
            nodes.put("top.opening", "<green>-----[ <white>Wealthiest Accounts <green>]-----");
            nodes.put("top.item", "<gray>+i. <green>+name <gray>- <white>+amount");
View Full Code Here

        if(iConomy.Server.getPlayer(name) == null)
            return;

        String tag = iConomy.Template.color(Template.Node.TAG_MONEY);

        Template template = iConomy.Template;
        template.set(Template.Node.PERSONAL_BALANCE);
        template.add("balance", getHoldings().getBalance());

        Messaging.send(player, tag + template.parse());
    }
View Full Code Here

    @Override
    public String toString() {
        String tag = iConomy.Template.raw(Template.Node.TAG_MONEY);

        Template template = iConomy.Template;
        template.set(Template.Node.PLAYER_BALANCE);
        template.add("name", name);
        template.add("balance", getHoldings().getBalance());

        return tag + template.parseRaw();
    }
View Full Code Here

    public void showBalance(CommandSender to) {
        if(to != null) {
            String tag = iConomy.Template.raw(Template.Node.TAG_MONEY);

            Template template = iConomy.Template;
            template.set(Template.Node.PLAYER_BALANCE);
            template.add("name", name);
            template.add("balance", toString());

            Messaging.send(to, tag + template.parse());
            return;
        }

        Player player = iConomy.Server.getPlayer(name);
        String tag = iConomy.Template.color(Template.Node.TAG_MONEY);

        if(iConomy.Server.getPlayer(name) == null)
            return;

        Template template = iConomy.Template;
        template.set(Template.Node.PERSONAL_BALANCE);
        template.add("balance", toString());
        Messaging.send(player, tag + template.parse());
    }
View Full Code Here

TOP

Related Classes of com.iCo6.handlers.Give

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.