StatsAPI
MySQL based stats API
Installation:
Need Java 8
1. Download StatsAPI.jar and put it in your plugins folder (Bukkit and Bungee)
2. Restart your server
3. Set your MySQL data in the database.yml
4. Restart your server again
How to use:
Put StatsAPI.jar in your Java Build Path!
Get the StatsAPI instance
StatsAPI api = StatsAPI.getAPI();
Get a StatsUser (used for manage Stats)
StatsUser user = api.getUser(UUID.fromString("fc5b5c4f-b057-40fb-8a99-4e0b597c5813"));
Now you can get Stats
Stats stats = user.getStats("sg") // "sg" is the group (or category). For example you use "sg" for your SurvivalGames stats and "bw" for BedWars
Set values
stats.set("kills", 20); // First argument is a String (Key) and the secound argument is a Object (Value)
stats.set("deaths", 4);
stats.set("coins", 300);
Get values
int kills = stats.getInt("kills");
int deaths = stats.getInt("deaths");
int coins = stats.getInt("coins");
You also can set/get Strings, List<?> and other Objects
stats.set("example", "example2");
String example = stats.getString("example");
stats.set("examplelist", Arrays.asList("This", "is", "a", "String", "List"));
List<String> exampleList = (List<String>) stats.getList("examplelist");
Get only a object
Object obj = stats.getObject("randomobject");
Also can remove values
stats.remove("coins");
Or remove all
stats.removeAll(); // this remove all values in the group
// or
user.remove("sg");
Check if key is set
if(stats.has("coins")) {
// DO SOMETHING
}
Check if value is String
if(stats.isString("kills")) {
// DO SOMETHING
}
If you want show all registered groups of a user
List<String> groups = user.getGroups();
And all keys of a group
List<String> keys = stats.getKeys();
If you have any questions, bugs or feature request send me a message
Similar projects
Plugin →Let Me Despawn
Improves performance by tweaking mob despawn rules. Say bye to pesky unintentional persistent mobs.
25MSueta
JourneyMap
Real-time map used for mapping in-game or your browser as you explore.
14.7MSueta
Emotecraft
Create your own emotes in Minecraft.
7.5MSueta
Simple Tpa
A simple tpa plugin which sends requests
5.4MSueta
Common Network
Forge and Fabric Unified Networking Solution
3.9MSueta
Set Home
A lightweight plugin for players to set their homes.
3.8MSueta