mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-26 18:11:29 +01:00
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:
parent
b827e83dd5
commit
5c6442fdb2
@ -330,7 +330,6 @@ public class ConfigNode {
|
|||||||
if (o == null || getClass() != o.getClass()) return false;
|
if (o == null || getClass() != o.getClass()) return false;
|
||||||
ConfigNode that = (ConfigNode) o;
|
ConfigNode that = (ConfigNode) o;
|
||||||
return Objects.equals(key, that.key) &&
|
return Objects.equals(key, that.key) &&
|
||||||
Objects.equals(parent, that.parent) &&
|
|
||||||
nodeOrder.equals(that.nodeOrder) &&
|
nodeOrder.equals(that.nodeOrder) &&
|
||||||
childNodes.equals(that.childNodes) &&
|
childNodes.equals(that.childNodes) &&
|
||||||
comment.equals(that.comment) &&
|
comment.equals(that.comment) &&
|
||||||
@ -339,6 +338,6 @@ public class ConfigNode {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(key, parent, nodeOrder, childNodes, comment, value);
|
return Objects.hash(key, childNodes, comment, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,6 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.UncheckedIOException;
|
import java.io.UncheckedIOException;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -43,9 +42,9 @@ public class ServerSettingsManager implements SubSystem {
|
|||||||
private final PlanFiles files;
|
private final PlanFiles files;
|
||||||
private final PlanConfig config;
|
private final PlanConfig config;
|
||||||
private final DBSystem dbSystem;
|
private final DBSystem dbSystem;
|
||||||
|
private ServerInfo serverInfo;
|
||||||
private final TaskSystem taskSystem;
|
private final TaskSystem taskSystem;
|
||||||
private final ErrorHandler errorHandler;
|
private final ErrorHandler errorHandler;
|
||||||
private final UUID serverUUID;
|
|
||||||
private PluginLogger logger;
|
private PluginLogger logger;
|
||||||
private FileWatcher watcher;
|
private FileWatcher watcher;
|
||||||
|
|
||||||
@ -62,10 +61,10 @@ public class ServerSettingsManager implements SubSystem {
|
|||||||
this.files = files;
|
this.files = files;
|
||||||
this.config = config;
|
this.config = config;
|
||||||
this.dbSystem = dbSystem;
|
this.dbSystem = dbSystem;
|
||||||
|
this.serverInfo = serverInfo;
|
||||||
this.taskSystem = taskSystem;
|
this.taskSystem = taskSystem;
|
||||||
this.logger = logger;
|
this.logger = logger;
|
||||||
this.errorHandler = errorHandler;
|
this.errorHandler = errorHandler;
|
||||||
serverUUID = serverInfo.getServerUUID();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -92,7 +91,7 @@ public class ServerSettingsManager implements SubSystem {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
Config config = new ConfigReader(file.toPath()).read();
|
Config config = new ConfigReader(file.toPath()).read();
|
||||||
database.save().saveConfig(serverUUID, config);
|
database.save().saveConfig(serverInfo.getServerUUID(), config);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new UncheckedIOException(e);
|
throw new UncheckedIOException(e);
|
||||||
}
|
}
|
||||||
@ -112,7 +111,7 @@ public class ServerSettingsManager implements SubSystem {
|
|||||||
File configFile = files.getConfigFile();
|
File configFile = files.getConfigFile();
|
||||||
long lastModified = configFile.exists() ? configFile.lastModified() : -1;
|
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()) {
|
if (foundConfig.isPresent()) {
|
||||||
try {
|
try {
|
||||||
new ConfigWriter(configFile.toPath()).write(foundConfig.get());
|
new ConfigWriter(configFile.toPath()).write(foundConfig.get());
|
||||||
|
Loading…
Reference in New Issue
Block a user