public boolean readConfig() { File file = new File(p.getDataFolder(), "config.yml"); if (!checkConfigs()) { return false; } FileConfiguration config = YamlConfiguration.loadConfiguration(file); // Set the Language language = config.getString("language", "en"); // Load LanguageReader languageReader = new LanguageReader(new File(p.getDataFolder(), "languages/" + language + ".yml")); // Check if config is the newest version String version = config.getString("version", null); if (version != null) { if (!version.equals(configVersion)) { new ConfigUpdater(file).update(version, language); P.p.log("Config Updated to version: " + configVersion); config = YamlConfiguration.loadConfiguration(file); } } // If the Update Checker should be enabled updateCheck = config.getBoolean("updateCheck", false); // Third-Party useWG = config.getBoolean("useWorldGuard", true) && getServer().getPluginManager().isPluginEnabled("WorldGuard"); if (useWG) { try { try { Class.forName("com.sk89q.worldguard.bukkit.RegionContainer"); wg = new WGBarrelNew(); } catch (ClassNotFoundException e) { wg = new WGBarrelOld(); } } catch (Throwable e) { wg = null; P.p.errorLog("Failed loading WorldGuard Integration! Opening Barrels will NOT work!"); P.p.errorLog("Brewery was tested with version 5.8 to 6.0 of WorldGuard!"); P.p.errorLog("Disable the WorldGuard support in the config and do /brew reload"); e.printStackTrace(); } } useLWC = config.getBoolean("useLWC", true) && getServer().getPluginManager().isPluginEnabled("LWC"); useGP = config.getBoolean("useGriefPrevention", true) && getServer().getPluginManager().isPluginEnabled("GriefPrevention"); useLB = config.getBoolean("useLogBlock", false) && getServer().getPluginManager().isPluginEnabled("LogBlock"); hasVault = getServer().getPluginManager().isPluginEnabled("Vault"); // various Settings DataSave.autosave = config.getInt("autosave", 3); debug = config.getBoolean("debug", false); BPlayer.pukeItem = Material.matchMaterial(config.getString("pukeItem", "SOUL_SAND")); BPlayer.hangoverTime = config.getInt("hangoverDays", 0) * 24 * 60; BPlayer.overdrinkKick = config.getBoolean("enableKickOnOverdrink", false); BPlayer.enableHome = config.getBoolean("enableHome", false); BPlayer.enableLoginDisallow = config.getBoolean("enableLoginDisallow", false); BPlayer.enablePuke = config.getBoolean("enablePuke", false); BPlayer.homeType = config.getString("homeType", null); Brew.colorInBarrels = config.getBoolean("colorInBarrels", false); Brew.colorInBrewer = config.getBoolean("colorInBrewer", false); PlayerListener.openEverywhere = config.getBoolean("openLargeBarrelEverywhere", false); Words.log = config.getBoolean("logRealChat", false); Words.commands = config.getStringList("distortCommands"); Words.doSigns = config.getBoolean("distortSignText", false); for (String bypass : config.getStringList("distortBypass")) { Words.ignoreText.add(bypass.split(",")); } // loading recipes ConfigurationSection configSection = config.getConfigurationSection("recipes"); if (configSection != null) { for (String recipeId : configSection.getKeys(false)) { BRecipe recipe = new BRecipe(configSection, recipeId); if (recipe.isValid()) { BIngredients.recipes.add(recipe); } else { errorLog("Loading the Recipe with id: '" + recipeId + "' failed!"); } } } // loading cooked names and possible ingredients configSection = config.getConfigurationSection("cooked"); if (configSection != null) { for (String ingredient : configSection.getKeys(false)) { Material mat = Material.matchMaterial(ingredient); if (mat == null && hasVault) { try { net.milkbowl.vault.item.ItemInfo vaultItem = net.milkbowl.vault.item.Items.itemByString(ingredient); if (vaultItem != null) { mat = vaultItem.getType(); } } catch (Exception e) { P.p.errorLog("Could not check vault for Item Name"); e.printStackTrace(); } } if (mat != null) { BIngredients.cookedNames.put(mat, (configSection.getString(ingredient, null))); BIngredients.possibleIngredients.add(mat); } else { errorLog("Unknown Material: " + ingredient); } } } // loading drainItems List<String> drainList = config.getStringList("drainItems"); if (drainList != null) { for (String drainString : drainList) { String[] drainSplit = drainString.split("/"); if (drainSplit.length > 1) { Material mat = Material.matchMaterial(drainSplit[0]); int strength = p.parseInt(drainSplit[1]); if (mat == null && hasVault && strength > 0) { try { net.milkbowl.vault.item.ItemInfo vaultItem = net.milkbowl.vault.item.Items.itemByString(drainSplit[0]); if (vaultItem != null) { mat = vaultItem.getType(); } } catch (Exception e) { P.p.errorLog("Could not check vault for Item Name"); e.printStackTrace(); } } if (mat != null && strength > 0) { BPlayer.drainItems.put(mat, strength); } } } } // telling Words the path, it will load it when needed Words.config = config; return true; }