API for devs
API
Actual Wiki going up here
How to hook into the plugin
private StatsAPI statsAPI; private boolean setupStatsAPI(){ RegisteredServiceProvider<StatsAPI> stats = getServer().getServicesManager().getRegistration(nl.lolmewn.stats.api.StatsAPI.class); if (stats!= null) { statsAPI = stats.getProvider(); } return (statsAPI != null); }
The methods inside the API are pretty self-explanatory, and have JavaDocs coverage here
Events
This plugin also provides you with some cool events. These are:
- StatUpdateEvent - gets called every time a stat gets updated. This is done in an async environment to not cause load to the main thread, so use this with caution. You can cancel this event.
- StatsSignCreateEvent - gets called when a sign with [Stats] on it gets placed. You can cancel this event.
- StatsSignUpdateEvent - gets called when a StatsSign updates. You can cancel this event.
- StatsSignDestroyEvent - gets called when a StatsSign gets destroyed. You can cancel this event.
Using Maven?
I've set up a Sonatype Nexus repository, which you can use to get the Stats dependency.
To your pom.xml, add this:
<repositories> ... <repository> <id>stats-repo</id> <url>http://lolmewn.nl:8081/nexus/content/repositories/releases/</url> </repository> ... </repositories> ... <dependencies> ... <dependency> <groupId>nl.lolmewn.stats</groupId> <artifactId>Stats</artifactId> <version>2.0.0</version> </dependency> ... </dependencies>
Comments