mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-03 18:43:43 +01:00 
			
		
		
		
	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:
		@@ -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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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();
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user