Fixed regression issues from new code:

- Fixed StackOverFlow from ConfigNode equals using parent
- Fixed enable fail due to call to ServerInfo#getServerUUID in constructor
This commit is contained in:
Rsl1122 2018-12-24 11:45:23 +02:00
parent b827e83dd5
commit 5c6442fdb2
2 changed files with 5 additions and 7 deletions

View File

@ -330,7 +330,6 @@ public class ConfigNode {
if (o == null || getClass() != o.getClass()) return false;
ConfigNode that = (ConfigNode) o;
return Objects.equals(key, that.key) &&
Objects.equals(parent, that.parent) &&
nodeOrder.equals(that.nodeOrder) &&
childNodes.equals(that.childNodes) &&
comment.equals(that.comment) &&
@ -339,6 +338,6 @@ public class ConfigNode {
@Override
public int hashCode() {
return Objects.hash(key, parent, nodeOrder, childNodes, comment, value);
return Objects.hash(key, childNodes, comment, value);
}
}

View File

@ -24,7 +24,6 @@ import java.io.File;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.Optional;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
/**
@ -43,9 +42,9 @@ public class ServerSettingsManager implements SubSystem {
private final PlanFiles files;
private final PlanConfig config;
private final DBSystem dbSystem;
private ServerInfo serverInfo;
private final TaskSystem taskSystem;
private final ErrorHandler errorHandler;
private final UUID serverUUID;
private PluginLogger logger;
private FileWatcher watcher;
@ -62,10 +61,10 @@ public class ServerSettingsManager implements SubSystem {
this.files = files;
this.config = config;
this.dbSystem = dbSystem;
this.serverInfo = serverInfo;
this.taskSystem = taskSystem;
this.logger = logger;
this.errorHandler = errorHandler;
serverUUID = serverInfo.getServerUUID();
}
@Override
@ -92,7 +91,7 @@ public class ServerSettingsManager implements SubSystem {
try {
Config config = new ConfigReader(file.toPath()).read();
database.save().saveConfig(serverUUID, config);
database.save().saveConfig(serverInfo.getServerUUID(), config);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
@ -112,7 +111,7 @@ public class ServerSettingsManager implements SubSystem {
File configFile = files.getConfigFile();
long lastModified = configFile.exists() ? configFile.lastModified() : -1;
Optional<Config> foundConfig = database.fetch().getNewConfig(lastModified, serverUUID);
Optional<Config> foundConfig = database.fetch().getNewConfig(lastModified, serverInfo.getServerUUID());
if (foundConfig.isPresent()) {
try {
new ConfigWriter(configFile.toPath()).write(foundConfig.get());