@Override public void setupFromConfig(Configuration cfg) { cfg.addCustomCategoryComment(CATEGORY_TYPE, "Settings for the sky dimlet type"); rarity = cfg.get(CATEGORY_TYPE, "rarity", rarity, "Default rarity for this dimlet type").getInt(); baseCreationCost = cfg.get( CATEGORY_TYPE, "creation.cost", baseCreationCost, "Dimlet creation cost (how much power this dimlets adds during creation time of a dimension)") .getInt(); baseMaintainCost = cfg.get( CATEGORY_TYPE, "maintenance.cost", baseMaintainCost, "Dimlet maintenance cost (how much power this dimlet will use up to keep the dimension running)") .getInt(); baseTickCost = cfg.get( CATEGORY_TYPE, "tick.cost", baseTickCost, "Dimlet tick cost (how long it takes to make a dimension with this dimlet in it)") .getInt(); }
private void readMainConfig() { Configuration cfg = mainConfig; try { cfg.load(); cfg.addCustomCategoryComment(Config.CATEGORY_GEARSWAP, "General configuration"); cfg.addCustomCategoryComment( Config.CATEGORY_RULES, "Rules that help decide if two items are considered equal. Every rule contains a list of tags that have to match"); Config.init(cfg); } catch (Exception e1) { GearSwap.logger.log(Level.ERROR, "Problem loading config file!", e1); } finally { if (mainConfig.hasChanged()) { mainConfig.save(); } } }
@Override public void doConfig(Configuration configuration) { configuration.addCustomCategoryComment(TYPES_CAT, "Reward config options"); configuration.addCustomCategoryComment(TYPES_CAT + '.' + NAME, "Used when spawning structures"); String[] bannedBlocksStrings = configuration .get( TYPES_CAT + '.' + NAME, "bannedBlocks", new String[0], "Banned blocks, format like this:\nid:metaData => Ban only that meta\nid => Ban all meta of that block") .getStringList(); bannedBlocks = new int[bannedBlocksStrings.length][]; for (int i = 0; i < bannedBlocksStrings.length; i++) { String[] split = bannedBlocksStrings[i].split(":"); if (split.length == 1) bannedBlocks[i] = new int[] {Integer.parseInt(split[0])}; else bannedBlocks[i] = new int[] {Integer.parseInt(split[0]), Integer.parseInt(split[1])}; } }
@Override public void setupFromConfig(Configuration cfg) { cfg.addCustomCategoryComment(CATEGORY_TYPE, "Settings for the terrain dimlet type"); materialCreationCostFactor = (float) cfg.get( CATEGORY_TYPE, "material.creation.factor", materialCreationCostFactor, "The cost factor for a material dimlet modifier when used in combination with this terrain") .getDouble(); liquidCreationCostFactor = (float) cfg.get( CATEGORY_TYPE, "liquid.creation.factor", liquidCreationCostFactor, "The cost factor for a liquid dimlet modifier when used in combination with this terrain") .getDouble(); materialMaintenanceCostFactor = (float) cfg.get( CATEGORY_TYPE, "material.maintenance.factor", materialMaintenanceCostFactor, "The cost factor for a material dimlet modifier when used in combination with this terrain") .getDouble(); liquidMaintenanceCostFactor = (float) cfg.get( CATEGORY_TYPE, "liquid.maintenance.factor", liquidMaintenanceCostFactor, "The cost factor for a liquid dimlet modifier when used in combination with this terrain") .getDouble(); materialTickCostFactor = (float) cfg.get( CATEGORY_TYPE, "material.tick.factor", materialTickCostFactor, "The cost factor for a material dimlet modifier when used in combination with this terrain") .getDouble(); liquidTickCostFactor = (float) cfg.get( CATEGORY_TYPE, "liquid.tick.factor", liquidTickCostFactor, "The cost factor for a liquid dimlet modifier when used in combination with this terrain") .getDouble(); }
@Override public void doConfig(Configuration configuration) { configuration.addCustomCategoryComment(CAT, "This is the checker for imraising.tv"); enabled = configuration.get(CAT, "enabled", enabled).getBoolean(enabled); APIKey = configuration.get(CAT, "APIKey", APIKey).getString(); interval = configuration .get(CAT, "interval", interval, "The time in between polls (in seconds).") .getInt(); min_donation = configuration .get( CAT, "min_donation", min_donation, "Donations below this amount will only be added to statistics and will not spawn rewards") .getDouble(); recentDonationsBasedHudEntry = new DonationsBasedHudEntry( "recent" + NAME + ".txt", CAT + ".recentDonations", -1, 2, 5, "$name: $$amount", "-- Recent donations --", CheckerHandler.RECENT_DONATION_COMPARATOR); topDonationsBasedHudEntry = new DonationsBasedHudEntry( "top" + NAME + ".txt", CAT + ".topDonations", -1, 1, 5, "$name: $$amount", "-- Top donations --", CheckerHandler.AMOUNT_DONATION_COMPARATOR); // Donation tracker doesn't allow a poll interval faster than 5 seconds // They will IP ban anyone using a time below 5 so force the value to be safe if (interval < 5) { interval = 5; // Now force the config setting to 5 configuration .get(CAT, "interval", "The time in between polls minimum 5 (in seconds).") .set(interval); } }
/// Initializes these properties. public static void init(Configuration config) { config.load(); ArrayList<String> order = new ArrayList<String>(); Properties.add( config, order, Properties.GENERAL, "dropRate", 0.03, "The chance (from 0 to 1) for a book to be dropped from a mob. Default is 0.03 (3% chance)."); Properties.add( config, order, Properties.GENERAL, "addChestLoot", true, "If this is true, dusty books will generate as chest loot. Default is true."); Properties.add( config, order, Properties.GENERAL, "markUnique", true, "If this is true, unique books will have an additional line under the author in their tooltip that says \"Unique\". (So people know which books they can not get again.) Default is true."); Properties.add( config, order, Properties.GENERAL, "uniqueBlackouts", true, "If this is true, unique books will not drop if every player on the server has picked one up. Default is true."); Properties.add( config, order, Properties.GENERAL, "hardUniqueBlackouts", true, "If this is true, unique books can not be picked up by any player more than once. This only applies to mob drops. Default is true."); Properties.add( config, order, Properties.GENERAL, "adaptiveDrops", true, "If this is true, non-unique books will drop more often to fill the place of blacked-out unique books. Default is true."); Properties.add( config, order, Properties.GENERAL, "lostBookCaptureRate", 1.0, "The chance (from 0 to 1) for books left on the floor to be saved to the list of \"lost\" books to be dropped later. Each save is deleted once its book has been dropped. Default is 1.0 (100% chance)."); for (String category : Properties.BOOK_CATEGORIES) { Properties.add( config, order, Properties.GENERAL, category + "BookWeight", category == "unique" ? 2 : 1, "The weighted chance that a dropped book will be " + (category == "adlib" ? "an " + category : "a " + category) + " book. Default is " + (category == "unique" ? 2 : 1) + "."); } // config.setCategoryPropertyOrder(Properties.GENERAL, order); order.clear(); Properties.add( config, order, Properties.LOST_BOOKS, "whitelist", "", "Comma separated list of entities that lost books will drop from. (e.g., Skeleton,Player,Zombie) Default is empty."); Properties.add( config, order, Properties.LOST_BOOKS, "blacklist", "", "Comma separated list of entities that lost books will NOT drop from. Default is empty."); Properties.add( config, order, Properties.LOST_BOOKS, "biomes", "", "Comma separated list of biome ids that lost books will drop in. If left empty, lost books will drop in all biomes. Default is empty."); // config.setCategoryPropertyOrder(Properties.LOST_BOOKS, order); order.clear(); Properties.add( config, order, Properties.TRADING, "tradeChance", 0.8, "The chance (from 0 to 1) for a generated book to be considered as a possible trade option. (Not the direct chance for a librarian to be selling a book.) Default is 0.8."); Properties.add( config, order, Properties.TRADING, "minBookCost", 2, "The minimum emerald cost (from 1 to 64) a villager will charge for a book. Default is 2."); Properties.add( config, order, Properties.TRADING, "maxBookCost", 4, "The maximum emerald cost (from 1 to 64) a villager will charge for a book. Default is 4."); Properties.add( config, order, Properties.TRADING, "sellLost", true, "If this is true, librarians will be able to find and sell lost books. Note that unless you \"lose\" a lot of books and/or have a really low lost book drop rate, you probably won't see any in trades anyway. Default is true."); Properties.add( config, order, Properties.TRADING, "sellUnique", false, "If this is true, librarians will be able to sell unique books. Trades ignore all unique blackout restrictions! Default is false."); // config.setCategoryPropertyOrder(Properties.TRADING, order); order.clear(); Properties.add( config, order, Properties.UTILS, "openToPreviousPage", true, "(Client-only) If true, books will reopen to the last page they were open to. Default is true."); Properties.add( config, order, Properties.UTILS, "pauseWhileReading", false, "(Client-only) If true, having a book open will pause the game in singleplayer, as it does in vanilla. Default is false."); // config.setCategoryPropertyOrder(Properties.UTILS, order); order.clear(); config.addCustomCategoryComment(Properties.GENERAL, "General and/or miscellaneous options."); config.addCustomCategoryComment( Properties.TRADING, "Options for trades with librarian villagers."); config.addCustomCategoryComment( Properties.LOST_BOOKS, "Equivalent to a book properties file. Applies to all \"lost\" books."); config.addCustomCategoryComment( Properties.UTILS, "Various options relating to books and the book gui."); config.save(); }