Skip to content

Instantly share code, notes, and snippets.

@Bastian
Last active October 1, 2021 20:47
Show Gist options
  • Save Bastian/6ed19dae0322881af4f3dab87075397f to your computer and use it in GitHub Desktop.
Save Bastian/6ed19dae0322881af4f3dab87075397f to your computer and use it in GitHub Desktop.
Simple Pie example
@Override
public void onEnable() {
Metrics metrics = new Metrics(this);
metrics.addCustomChart(new SimplePie("used_language", () -> {
return getConfig.getString("language", "en");
}));
}
// If you use the Copy & Paste Metrics classes, use `Metrics.SimplePie` instead
@Andre601
Copy link

This example should be simplified as (at least) Java 8 supports simpler Lambda expressions.
E.g.

@Override
public void onEnable() {
    Metrics metrics = new Metrics(this);
    metrics.addCustomChart(new Metrics.SimplePie("used_language", () -> {
        return getConfig.getString("language", "en");
    }));
}

@dlsf
Copy link

dlsf commented Oct 1, 2021

getConfig should probably be changed to getConfig()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment