The API can be simply accessed using the class named SuperSmashXAPI.
Methods:
- getTopPlayers (Should run async)
- First argument is the players data which you can get from SuperSmashXAPI.getAllPlayersData()
- Second argument is the stat, for example Stat.WINS
- Third argument is the amount of top players you are looking for
Example:
Code (Text):
HashMap<String, String> data = SuperSmashXAPI.getAllPlayersData(); //Get all players data
List<Entry<String, Integer>> players = SuperSmashXAPI.getTopPlayers(data, Stat.WINS, 10); //Get the top 10 players for the wins stat and put them in the 'players' list
//Entry key is the player name, and the entry value is their score
for(int i = 0; i < players.size(); i++){
Bukkit.broadcastMessage("# " + (i+1) + " is " + players.get(i).getKey() + " with a score of " + players.get(i).getValue());
}
- SuperSmashXAPI.modifyOfflinePlayerStat (Should run async)
- First argument is the player name
- Second argument is the Stat that you want to modify, for example Stat.COINS
- Third argument is the value
- Fourth argument is a boolean which indicates whether the value (3rd argument) should be 'added' to the existing score or the stat should be just overwritten to the value.
Example:
Code (Text):
SuperSmashXAPI.modifyOfflinePlayerStat("Hello", Stat.COINS, 1000, false); //This will set player coins to 1000
SuperSmashXAPI.modifyOfflinePlayerStat("Hello", Stat.COINS, 1000, true); //This will add 1000 coin to the player
You can also access lots of methods using class instances.
The main class instance can be retrieved using SuperSmashX.getInstance()
You can access the customization class with Customization.getInstance() and the config class with Config.getInstance() and many other classes. But you are not really supposed to use those and they won't be documented. So ask me for help before using methods in those classes.