Initialization cleanup: use provider classes for Settings and DataSource

- Separate provider methods from other tasks performed on startup
  - No longer requires BukkitService to be instantiated manually
- Merge MetricsManager and Initializer into OnStartUpTasks
This commit is contained in:
ljacqu
2016-11-06 18:51:07 +01:00
parent f2cafe4f25
commit 72853a382f
11 changed files with 340 additions and 255 deletions
@@ -98,6 +98,22 @@ public final class FileUtils {
}
}
/**
* Creates the given file or throws an exception.
*
* @param file the file to create
*/
public static void create(File file) {
try {
boolean result = file.createNewFile();
if (!result) {
throw new IllegalStateException("Could not create file '" + file + "'");
}
} catch (IOException e) {
throw new IllegalStateException("Error while creating file '" + file + "'", e);
}
}
/**
* Construct a file path from the given elements, i.e. separate the given elements by the file separator.
*