Cleanup, take 3

This commit is contained in:
Gabriele C
2016-08-09 14:53:22 +02:00
parent ec3db792ed
commit 4f1d6585cf
4 changed files with 73 additions and 53 deletions
@@ -1,7 +1,5 @@
package fr.xephi.authme.datasource;
import com.google.common.annotations.VisibleForTesting;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.ConsoleLogger;
import fr.xephi.authme.cache.auth.PlayerAuth;
import fr.xephi.authme.cache.auth.PlayerCache;
@@ -41,19 +39,13 @@ public class FlatFile implements DataSource {
*/
private final File source;
public FlatFile(AuthMe authMe) throws IOException {
source = new File(authMe.getDataFolder(), "auths.db");
boolean createResult = source.createNewFile();
if (!createResult) {
public FlatFile(File source) throws IOException {
this.source = source;
if (!source.exists() && !source.createNewFile()) {
throw new IOException("Could not create file '" + source.getPath() + "'");
}
}
@VisibleForTesting
public FlatFile(File source) {
this.source = source;
}
@Override
public void reload() {
throw new UnsupportedOperationException("Flatfile no longer supported");