Add graph to see if any config values have been changed from the default, or if a server is 100% vanilla configs

This commit is contained in:
NuclearW 2013-02-22 01:08:37 -05:00
parent e50eb1963f
commit 3dc1afde7e
2 changed files with 35 additions and 0 deletions

View File

@ -16,6 +16,7 @@ import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.configuration.file.YamlConfiguration;
import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.util.metrics.MetricsManager;
public abstract class ConfigLoader {
protected static final mcMMO plugin = mcMMO.p;
@ -129,6 +130,14 @@ public abstract class ConfigLoader {
e.printStackTrace();
}
}
else {
for (String key : configKeys) {
if (!config.isConfigurationSection(key) && !config.get(key).equals(internalConfig.get(key))) {
MetricsManager.customConfig();
break;
}
}
}
}
protected abstract void loadKeys();

View File

@ -22,6 +22,8 @@ public class MetricsManager {
private static Tracker chimeraUseTracker;
private static Tracker chimeraServerUseTracker;
private static boolean customConfig = false;
private static DataTracker tracker;
private static EMetrics emetrics;
@ -220,6 +222,26 @@ public class MetricsManager {
});
}
// Vanilla v Modified config graph
Graph customConfigGraph = metrics.createGraph("Modified Configs");
if (customConfig) {
customConfigGraph.addPlotter(new Metrics.Plotter("Edited") {
@Override
public int getValue() {
return 1;
}
});
}
else {
customConfigGraph.addPlotter(new Metrics.Plotter("Vanilla") {
@Override
public int getValue() {
return 1;
}
});
}
/* Debug stuff
tracker = emetrics.getDataTracker();
tracker.enable();
@ -239,6 +261,10 @@ public class MetricsManager {
chimeraServerUseTracker.increment();
}
public static void customConfig() {
customConfig = true;
}
@SuppressWarnings("unused")
private static void debug() {
emetrics.getMetrics().flush();