.addCode(exStackTrace, null);
}
// PEX Configuration
YamlConfiguration pexConfig = new YamlConfiguration();
boolean successfulLoad = false;
final File mainConfigFile = pexPlugin != null ? new File(pexPlugin.getDataFolder(), "config.yml") : null;
String configuration;
String permissionsDb = "Permissions configuration could not be read. Does it exist?";
String activeBackend = "unknown";
if (mainConfigFile == null) {
configuration = "PEX plugin was inaccessible!";
} else if (mainConfigFile.exists()) {
try {
pexConfig.load(mainConfigFile);
successfulLoad = true;
} catch (IOException | InvalidConfigurationException ignore) {
}
try {
configuration = StringUtils.readStream(new FileInputStream(mainConfigFile));
} catch (IOException e1) {
configuration = "Unable to read configuration file at: " + mainConfigFile.getAbsolutePath();
}
} else {
configuration = "PEX configuration does not exist!";
}
configuration = configuration.replaceAll("password: (.*)", "password: XXXXXXXXXX"); // Attempt to remove any passwords from the file (SQL)
builder.addHeading("PEX configuration")
.addCode(configuration, "yaml");
// Permissions database
if (pexPlugin != null) {
PermissionManager manager = pexPlugin.getPermissionsManager();
if (manager != null) {
PermissionBackend backend = manager.getBackend();
try {
if (backend != null) {
final StringWriter writer = new StringWriter();
backend.writeContents(writer);
permissionsDb = writer.toString();
activeBackend = backend.toString();
}
} catch (Throwable t) {
// Continue
}
}
if (permissionsDb == null && pexConfig.getString("permissions.backends." + pexConfig.getString("permissions.backend", "file") + ".type", "file").equalsIgnoreCase("file")) {
File file = new File(pexPlugin.getDataFolder(), pexConfig.getString("permissions.backends.file.file", "permissions.yml"));
if (file.exists()) {
try {
permissionsDb = StringUtils.readStream(new FileInputStream(file));
activeBackend = "file";
} catch (IOException ignore) {