-
-
Save Bastian/090987ee9274d2366a2c615cc6cfe2b4 to your computer and use it in GitHub Desktop.
Velocity Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Plugin(id = "myfirstplugin", name = "My First Plugin", version = "0.1.0-SNAPSHOT", | |
url = "https://example.org", description = "I did it!", authors = {"Me"}) | |
public class MyFirstPlugin { | |
private final ProxyServer server; | |
private final Logger logger; | |
private final Metrics.Factory metricsFactory; | |
@Inject | |
public MyFirstPlugin(ProxyServer server, Logger logger, Metrics.Factory metricsFactory) { | |
this.server = server; | |
this.logger = logger; | |
this.metricsFactory = metricsFactory; | |
} | |
@Subscribe | |
public void onProxyInitialization(ProxyInitializeEvent event) { | |
// All you have to do is adding the following two lines in your onProxyInitialization method. | |
// 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 metrics = metricsFactory.make(this, pluginId); | |
// You can also add custom charts: | |
metrics.addCustomChart(new SimplePie("chart_id", () -> "value")); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment