Home›Java›Mods›RankingLib
RankingLib
ModsJava

RankingLib

Java mod listed for Minecraft 1.8–1.15. Downloads from the MC Java Mods app on Android.

⬇ Download on Spigot
Using this libraries to calculate the rank with customizable method!

This plugin is for developer use only. If you want to try the calculation with normalized data, you can check out this.

About Maven

HTML:
  <repository>
            <id>xuan </id>
            <url>http://xuan.nctu.me:8081/repository/Maven/ </url>
</repository>

<dependency>
  <groupId>com.ericlam.mc </groupId>
  <artifactId>RankingLib </artifactId>
  <version>1.0.0 </version>
</dependency>
Example
The implementation example is in here.

Tutorial
First, hooking the RankingLib.jar into your project.


And then you would like to call the API as below
Code (Java):
RankLibAPI api = RankingLib. getRankAPI ( ) ;


In general, RankingLib has provided two default calculators inside(z_score and min max, both are normalization) . However, if you wish to create your own calculation method, you can create as below
For example, I wanna create a calculation method named "z-score"
Code (Java):
api. registerCalculator ( "z-score", (playerData, ladderRanks, arrayData ) -> {
            double v = playerData. getScore ( ) ;
            double result = AdvMath. round ( 2, (v - arrayData. getMean ( ) ) / arrayData. getSd ( ) ) ;
            int minScore = ( int ) - Math. floor ( ( int ) (ladderRanks. size ( ) / 2 ) ) ;
            int scoreIndex = ( ( int ) result ) - minScore ;
            if (scoreIndex < 0 ) {
                return ladderRanks. get ( 0 ) ;
            } else if (scoreIndex > ladderRanks. size ( ) ) {
                return ladderRanks. get (ladderRanks. size ( ) - 1 ) ;
            }
            RankDataImpl rank = (RankDataImpl ) ladderRanks. get (scoreIndex ) ;
            rank. setnScore (result ) ;
            rank. setOrigScore (v ) ;
            return rank ;
        } ) ;

After that, you need to call a factory and put all of your player data and rank data to build the RankDataManager:

Code (Java):
RankDataManager manager = api. getFactory ( ). addPlayers (dataList ). registerRanks (rankData ). build ( ) ;


dataList = List<PlayerData>
rankData = TreeSet<RankData>

These two need to create by your own.

You may need to register the saving mechanic if you want to save the player data.

To do calculate, you would like to use the method as below:
Code (Java):
manager. doCalculate ( "z-score" ). whenComplete ( (map, ex ) -> {
            if (ex != null ) {
                ex. printStackTrace ( ) ;
            }
        } ) ;
Then the result has generated.

You can use other method to do what you want!

Check out the other method in RankDataManager from here

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

RankingLib is a free Minecraft Java mod. Compatible with Minecraft 1.8, 1.9, 1.10, 1.11 and newer. Downloaded 239 times (via Spigot). Download it and open it directly in the game.

Explore more