This library is deprecated and will not be maintained anymore and it will not receive updates as I don't have time on my hands. There's so you may use that instead.
If you're looking for version compatible with Android, please go here: https://github.com/Lukaszpg/jPUBG-Android
Looking for help? Join our Gitter:
Simple API wrapper written in Java 8 for retriving statistics from http://pubgtracker.com API. You need valid pubgtracker.com API KEY in order to use my API wrapper. You can get one here: https://pubgtracker.com/site-api.
It's simple - just add few lines below to your pom.xml and you're good to go! X.X.X is of course preferable version of the library.
<dependency>
<groupId>pro.lukasgorny</groupId>
<artifactId>jpubg</artifactId>
<version>X.X.X</version>
</dependency>
To get the library file compiled with Java 1.8.0_131 please go to releases and download latest available version. Add it to your project classpath, then get the jPUBG API wrapper object from the factory with your api key and start fetching data!
// Always remember to specify your API key
JPubg jPubg = JPubgFactory.getWrapper(YOUR_API_KEY);
// We're filtering by mode here. If you don't want to filter by certain criteria, just don't pass it to the filter
FilterCriteria criteria = new FilterCriteria();
criteria.setMode(PUBGMode.solo);
// You can also create object of FilterCriteria class with constructor with arguments
FilterCriteria criteria2 = new FilterCriteria(PUBGMode.solo, PUBGRegion.eu, PUBGSeason.PRE2_2017);
// If you would like to stop filtering by that criteria, just pass the null value
// If no criterias are specified, player object without data filtering will be returned
criteria.setMode(null);
// All solo matches from all seasons are being returned here
// Always remember to use try-catch block for error processing!
try {
Player player = jPubg.getByNickname("TheHusar", criteria);
} catch (IllegalArgumentException e) {
System.out.println("Player could not be found or validated: " + e.getLocalizedMessage());
}
WARNING! You have to be very specific with filters if you want to retrieve single stat from season data, because if more than one season data will be present in player object, exception will be called.
// Always remember to specify your API key
JPubg jPubg = JPubgFactory.getWrapper(YOUR_API_KEY);
// We're filtering by mode, region and season here
FilterCriteria criteria = new FilterCriteria();
criteria.setMode(PUBGMode.solo);
criteria.setRegion(PUBGRegion.eu);
criteria.setSeason(PUBGSeason.PRE2_2017);
Player player = null;
// Always remember to use try-catch block for error processing!
try {
player = jPubg.getByNickname("TheHusar", criteria);
} catch (IllegalArgumentException e) {
System.out.println("Player could not be found or validated: " + e.getLocalizedMessage());
}
if(player != null) {
// We would like to retrieve best rating for player "TheHusar" for season PRE2_2017
Stat stat = jPubg.getPlayerMatchStatByStatName(player, PUBGStat.BEST_RATING);
// You can get season name directly from stat object
System.out.println("Player " + player.getPlayerName() + " best rating in season: " + stat.getSeason().getSeasonName() + " is: " + stat.getStringValue());
}
As this is completely Open Source project, you may clone the code from the Github and compile the library on your own.
- Be sure that you have Maven (at least version 3.3.9) installed.
- Go to the directory where you have cloned the repository.
- Perform mvn clean package command and wait a minute.
- Compiled .jar file will appear in the /target folder. The one you should use is named jPUBG-X.X.X-SNAPSHOT-jar-with-dependencies.jar, where X.X.X is of course version of the application.
Documentation is available on: http://www.javadoc.io/doc/pro.lukasgorny/jpubg
JavaDocs are updated once per 24h after new version release.