mirror of
https://github.com/boy0001/FastAsyncWorldedit.git
synced 2025-02-06 15:41:20 +01:00
Recover from invalid bstats configuration
This commit is contained in:
parent
4a9721edd3
commit
25ef3a0c81
@ -92,13 +92,18 @@ public class BStats implements Closeable {
|
|||||||
|
|
||||||
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
|
YamlConfiguration config = YamlConfiguration.loadConfiguration(configFile);
|
||||||
|
|
||||||
|
if (config.isSet("serverUuid")) {
|
||||||
|
try {
|
||||||
|
serverUUID = UUID.fromString(config.getString("serverUuid"));
|
||||||
|
} catch (IllegalArgumentException ignore) {}
|
||||||
|
}
|
||||||
// Check if the config file exists
|
// Check if the config file exists
|
||||||
if (!config.isSet("serverUuid")) {
|
if (serverUUID == null) {
|
||||||
|
|
||||||
// Add default values
|
// Add default values
|
||||||
config.addDefault("enabled", true);
|
config.addDefault("enabled", true);
|
||||||
// Every server gets it's unique random id.
|
// Every server gets it's unique random id.
|
||||||
config.addDefault("serverUuid", UUID.randomUUID().toString());
|
config.addDefault("serverUuid", (serverUUID = UUID.randomUUID()).toString());
|
||||||
// Should failed request be logged?
|
// Should failed request be logged?
|
||||||
config.addDefault("logFailedRequests", false);
|
config.addDefault("logFailedRequests", false);
|
||||||
|
|
||||||
@ -114,8 +119,6 @@ public class BStats implements Closeable {
|
|||||||
} catch (IOException ignored) { }
|
} catch (IOException ignored) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load the data
|
|
||||||
serverUUID = UUID.fromString(config.getString("serverUuid"));
|
|
||||||
|
|
||||||
if (usedMetricsClass != null) {
|
if (usedMetricsClass != null) {
|
||||||
// Already an instance of this class
|
// Already an instance of this class
|
||||||
|
Loading…
Reference in New Issue
Block a user