use of com.djrapitops.plan.exceptions.EnableException in project Plan by plan-player-analytics.
the class ConfigSystem method enable.
@Override
public void enable() {
try {
copyDefaults();
config.reorder(Arrays.asList("Server", "Network", "Plugin", "Database", "Webserver", "Data_gathering", "Time", "Display_options", "Formatting", "World_aliases", "Export", "Plugins"));
config.save();
checkWrongTimeZone();
} catch (IOException e) {
errorLogger.error(e, ErrorContext.builder().whatToDo("Fix write permissions to " + config.getConfigFilePath()).build());
throw new EnableException("Failed to save default config: " + e.getMessage(), e);
}
theme.enable();
}
use of com.djrapitops.plan.exceptions.EnableException in project Plan by plan-player-analytics.
the class ServerFileLoader method load.
@Override
public Optional<Server> load(ServerUUID loaded) {
try {
if (!prepared)
prepare();
String serverUUIDString = getString("Server.UUID");
if (serverUUIDString == null)
return Optional.empty();
Integer id = getInteger("Server.ID");
ServerUUID serverUUID = ServerUUID.fromString(serverUUIDString);
String name = config.getNode(PluginSettings.SERVER_NAME.getPath()).map(ConfigNode::getString).orElse("Proxy");
String address = getString("Server.Web_address");
return Optional.of(new Server(id, serverUUID, name, address, false));
} catch (IOException e) {
throw new EnableException("Failed to read ServerInfoFile.yml: " + e.getMessage());
}
}
use of com.djrapitops.plan.exceptions.EnableException in project Plan by plan-player-analytics.
the class PlanFiles method enable.
@Override
public void enable() {
ResourceCache.invalidateAll();
ResourceCache.cleanUp();
try {
Path dir = getDataDirectory();
if (!Files.isSymbolicLink(dir))
Files.createDirectories(dir);
if (!configFile.exists())
Files.createFile(configFile.toPath());
} catch (IOException e) {
throw new EnableException("Failed to create config.yml, " + e.getMessage(), e);
}
}
use of com.djrapitops.plan.exceptions.EnableException in project Plan by plan-player-analytics.
the class BungeeServerInfo method registerServer.
/**
* @throws EnableException
*/
private Server registerServer() {
Server proxy = createServerObject();
fromDatabase.save(proxy);
Server stored = fromDatabase.load(null).orElseThrow(() -> new EnableException("BungeeCord registration failed (DB)"));
fromFile.save(stored);
return stored;
}
use of com.djrapitops.plan.exceptions.EnableException in project Plan by plan-player-analytics.
the class DBSystem method enable.
@Override
public void enable() {
try {
db.init();
logger.info(locale.getString(PluginLang.ENABLED_DATABASE, db.getType().getName()));
} catch (DBInitException e) {
Throwable cause = e.getCause();
String message = cause == null ? e.getMessage() : cause.getMessage();
throw new EnableException(db.getType().getName() + " init failure: " + message, cause);
}
}
Aggregations