public void essentialsCheck() { if (this.ess != null) { ISettings settings = this.ess.getSettings(); if (settings == null) { this.ess = null; return; } if (!settings.areSignsDisabled()) { SignShop.log("Essentials signs are enabled, will conflict with SignShop", Level.WARNING); FileConfiguration config = this.ess.getConfig(); if (config == null) { this.ess = null; return; } try { FileReader reader = new FileReader(ess.getDataFolder() + "/config.yml"); if (reader == null) return; BufferedReader buffreader = new BufferedReader(reader); String line; File newFile = new File(ess.getDataFolder(), "config_2.yml"); if (!newFile.exists()) newFile.createNewFile(); FileWriter writer = new FileWriter(ess.getDataFolder() + "/config_2.yml"); boolean doComment = false; while ((line = buffreader.readLine()) != null) { if (line.contains("signs-disabled")) line = line.replace("false", "true"); if (doComment && line.contains(":")) doComment = false; if (line.contains("enabledSigns")) doComment = true; if (doComment && !line.contains("#") && line.contains("-")) writer.write("# " + line + "\n"); else writer.write(line + "\n"); } writer.close(); reader.close(); File oldFile = new File(ess.getDataFolder(), "config.yml"); File bakFile = new File(ess.getDataFolder(), "config.bak"); if (bakFile.exists()) bakFile.delete(); oldFile.renameTo(bakFile); if (!newFile.renameTo(oldFile)) return; } catch (IOException IOex) { return; } SignShop.log( "Disabled Essentials signs through Essentials' config.yml, reloading config now.", Level.INFO); this.ess.reload(); } } }