Skip to content

Simple API wrapper written in Java 8 for retriving statistics from http://pubgtracker.com API.

License

Notifications You must be signed in to change notification settings

nikkisingh111333/jPUBG

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DEPRECATED

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 PUBGj so you may use that instead.

jPUBG

Build Status GitHub license Maven Central Javadocs

Android version

If you're looking for version compatible with Android, please go here: https://github.com/Lukaszpg/jPUBG-Android

Support

Looking for help? Join our Gitter: Gitter chat

Overview

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.

How to get

1. Using Maven

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>

2. As a standalone library

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!

Example usage

Simple FilterCriteria

// 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());
}

Stat from season filtering

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());
}

Compiling on your own

As this is completely Open Source project, you may clone the code from the Github and compile the library on your own.

  1. Be sure that you have Maven (at least version 3.3.9) installed.
  2. Go to the directory where you have cloned the repository.
  3. Perform mvn clean package command and wait a minute.
  4. 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

Documentation is available on: http://www.javadoc.io/doc/pro.lukasgorny/jpubg

JavaDocs are updated once per 24h after new version release.

About

Simple API wrapper written in Java 8 for retriving statistics from http://pubgtracker.com API.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%