Added setup features for custom fileName
This commit is contained in:
@@ -36,11 +36,20 @@ import nodash.models.NoUser;
|
|||||||
|
|
||||||
public final class NoHashSphereDefault implements NoHashSphereInterface {
|
public final class NoHashSphereDefault implements NoHashSphereInterface {
|
||||||
private Set<String> database = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
|
private Set<String> database = Collections.newSetFromMap(new ConcurrentHashMap<String, Boolean>());
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
public NoHashSphereDefault(String fileName) {
|
||||||
|
this.fileName = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoHashSphereDefault() {
|
||||||
|
this.fileName = NoCore.config.databaseFilename;
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void setup() {
|
public void setup() {
|
||||||
if (NoCore.config.saveDatabase) {
|
if (NoCore.config.saveDatabase) {
|
||||||
File file = new File(NoCore.config.databaseFilename);
|
File file = new File(this.fileName);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
try {
|
try {
|
||||||
byte[] data = Files.readAllBytes(file.toPath());
|
byte[] data = Files.readAllBytes(file.toPath());
|
||||||
|
|||||||
Reference in New Issue
Block a user