Package net.citizensnpcs.properties

Examples of net.citizensnpcs.properties.Storage


    public static void clearGlobal() {
        globalStock.clear();
    }

    public static void loadGlobal() {
        Storage storage = UtilityProperties.getConfig();
        for (Object key : storage.getKeys("traders.global-prices")) {
            String path = "traders.global-prices." + key;
            int itemID = storage.getInt(path + ".id", 1);
            int amount = storage.getInt(path + ".amount", 1);
            short data = (short) storage.getInt(path + ".data");
            double price = storage.getDouble(path + ".price");
            boolean selling = !storage.getBoolean(path + ".selling", false);
            if (itemID > 0 && amount > 0) {
                Stockable stock = new Stockable(new ItemStack(itemID, amount, data), new ItemPrice(price), selling);
                globalStock.put(stock.createCheck(), stock);
            }
        }
View Full Code Here


    /*
     * Sets up miscellaneous variables, mostly reading from property files.
     */
    public static void setupVariables() {
        PropertyManager.registerProperties();
        Storage local = null;
        // Only load settings for loaded NPC types
        for (String t : Citizens.loadedTypes) {
            nodes.add(new Node("", SettingsType.GENERAL, "economy.prices." + t + ".creation", 100));
            if (NPCTypeManager.getType(t).getProperties().getNodes() == null) {
                continue;
            }
            for (Node node : NPCTypeManager.getType(t).getProperties().getNodes()) {
                nodes.add(node);
            }
        }
        for (Node node : nodes) {
            local = node.getFile();
            if (!local.keyExists(node.getPath())) {
                Messaging.log("Writing default setting " + node.getPath() + ".");
                local.setRaw(node.getPath(), node.getValue());
            } else {
                node.set(local.getRaw(node.getPath()));
            }
            loadedNodes.put(node.getName(), node);
            local.save();
        }
    }
View Full Code Here

TOP

Related Classes of net.citizensnpcs.properties.Storage

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.