org.bstats.sponge.Metrics2 Java Examples

The following examples show how to use org.bstats.sponge.Metrics2. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SkinsRestorer.java    From SkinsRestorerX with GNU General Public License v3.0 5 votes vote down vote up
@Listener
public void onServerStarted(GameStartedServerEvent event) {
    if (!Sponge.getServer().getOnlineMode()) {
        Sponge.getEventManager().registerListener(this, ClientConnectionEvent.Auth.class, new LoginListener(this));
    }

    metrics.addCustomChart(new Metrics2.SingleLineChart("mineskin_calls", MetricsCounter::collectMineskin_calls));
    metrics.addCustomChart(new Metrics2.SingleLineChart("minetools_calls", MetricsCounter::collectMinetools_calls));
    metrics.addCustomChart(new Metrics2.SingleLineChart("mojang_calls", MetricsCounter::collectMojang_calls));
    metrics.addCustomChart(new Metrics2.SingleLineChart("backup_calls", MetricsCounter::collectBackup_calls));
}
 
Example #2
Source File: ExamplePlugin.java    From bStats-Metrics with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Inject
public ExamplePlugin(Metrics2.Factory metricsFactory) {
    // You can find the plugin ids of your plugins on the page https://bstats.org/what-is-my-plugin-id
    int pluginId = 1234; // <-- Replace with the id of your plugin!
    metrics = metricsFactory.make(pluginId);
}
 
Example #3
Source File: ExamplePlugin.java    From bStats-Metrics with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Listener
public void onServerStart(GameStartedServerEvent event) {
    metrics.addCustomChart(new Metrics2.SimplePie("chart_id", () -> "My value"));
}
 
Example #4
Source File: BStatsSponge.java    From Plan with GNU Lesser General Public License v3.0 4 votes vote down vote up
public BStatsSponge(Metrics2 metrics, Database database) {
    this.metrics = metrics;
    this.database = database;
}
 
Example #5
Source File: BStatsSponge.java    From Plan with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected void addStringSettingPie(String id, Serializable setting) {
    metrics.addCustomChart(new Metrics2.SimplePie(id, setting::toString));
}