Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public class MetricsLite {
/**
* Unique server id
*/
private final String guid;
private String guid;

/**
* Debug mode
Expand Down Expand Up @@ -125,15 +125,14 @@ public MetricsLite(Plugin plugin) throws IOException {

configurationFile.createNewFile(); // config file
properties.put("opt-out", "false");
properties.put("guid", UUID.randomUUID().toString());
properties.put("debug", "false");
properties.store(new FileOutputStream(configurationFile), "http://mcstats.org");
} else {
properties.load(new FileInputStream(configurationFile));
}

// Load the guid then
guid = properties.getProperty("guid");
guid = ProxyServer.getInstance().getConfigurationAdapter().getString("stats", UUID.randomUUID().toString());
debug = Boolean.parseBoolean(properties.getProperty("debug"));
}

Expand Down Expand Up @@ -221,7 +220,8 @@ public boolean isOptOut() {
return true;
}

return Boolean.parseBoolean(properties.getProperty("opt-out"));
guid = ProxyServer.getInstance().getConfigurationAdapter().getString("stats", UUID.randomUUID().toString());
return guid.equals("null") || Boolean.parseBoolean(properties.getProperty("opt-out"));
}
}

Expand Down
8 changes: 4 additions & 4 deletions mods/bungee/metrics/src/main/java/org/mcstats/Metrics.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public class Metrics {
/**
* Unique server id
*/
private final String guid;
private String guid;
/**
* Debug mode
*/
Expand Down Expand Up @@ -141,15 +141,14 @@ public Metrics(final Plugin plugin) throws IOException {

configurationFile.createNewFile(); // config file
properties.put("opt-out", "false");
properties.put("guid", UUID.randomUUID().toString());
properties.put("debug", "false");
properties.store(new FileOutputStream(configurationFile), "http://mcstats.org");
} else {
properties.load(new FileInputStream(configurationFile));
}

// Load the guid then
guid = properties.getProperty("guid");
guid = ProxyServer.getInstance().getConfigurationAdapter().getString("stats", UUID.randomUUID().toString());
debug = Boolean.parseBoolean(properties.getProperty("debug"));
}

Expand Down Expand Up @@ -294,7 +293,8 @@ public boolean isOptOut() {
return true;
}

return Boolean.parseBoolean(properties.getProperty("opt-out"));
guid = ProxyServer.getInstance().getConfigurationAdapter().getString("stats", UUID.randomUUID().toString());
return guid.equals("null") || Boolean.parseBoolean(properties.getProperty("opt-out"));
}
}

Expand Down