Dependencies | Implementation | Getting Started
StatisticsLib makes storing and retrieving player statistics for players on a spigot/bukkit server alot easier. At its core, it stores every statistic for every player ever joined on a server onto your desired sql database. It handles all tables, sql functions and queries. You wanted to see how many diamond axes you've broken? We got it. You can either choose to download it as a jar file or use it with maven
NOTE: Maven support is coming soon. We are currently waiting for our project to be accepted to Maven Central.
- Spigot API - 1.17+
Spigot-API is licensed under the GNU General Public License v3.0 - Java JDK - 16+
This software is licensed under the Oracle BSD License
<repositories>
<repository>
<id>StatisticsLib</id>
<url>https://maven.devfalsk.com/repository/StatisticsLib/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.devfalsk.statisticslib</groupId>
<artifactId>statisticslib</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
- Download the latest jar file from here
- Add the jar file to your server's plugins folder
- Open your preferred IDE and add a new external jar file to the project structure
- Start coding!
Jump right in to using the your freshly added StatisticsLib!
Use this demo class to get started. More demo classes can also be found in demo.me.dehys.myplugin
public class MyPlugin extends JavaPlugin {
private StatisticsLib lib;
@Override
public void onEnable() {
super.onEnable();
if (!setupStatisticsLib()) {
getServer().getPluginManager().disablePlugin(this);
}
}
/**
* This method is used to fetch the active StatisticsLib instance from Bukkit's RegisteredServiceProvider
*
* @return true if an instance could be found, false if no instance could be found. In this case disable your statisticsPlugin.
* You *need* the instance registered to the Provider, creating your own instance can lead to loss of data
*/
private boolean setupStatisticsLib() {
if (getServer().getPluginManager().getPlugin("StatisticsLib") == null) {
return false;
}
RegisteredServiceProvider<StatisticsLib> serviceProvider = getServer().getServicesManager().getRegistration(StatisticsLib.class);
if (serviceProvider == null) {
return false;
}
lib = serviceProvider.getProvider();
return true;
}
/**
* Use this getter to access the StatisticsLib instance anywhere in your statisticsPlugin
*
* @return the active instance of StatisticsLib
*/
public StatisticsLib getLib() {
return lib;
}
/**
* Use this getter to access the StatisticsManager instance.
* The StatisticsManager provides all methods for handling statistics, most importantly, for retrieving them
*
* @return the active instance of StatisticsManager
*/
public StatisticsManager getStatisticsManager() {
return lib.getStatisticsManager();
}
}
This project is under license from MIT. For more details, see the LICENSE file.