Skip to content

Java API that makes integrating with the Buycraft Plugin API so easy!

License

Notifications You must be signed in to change notification settings

9Y0/BuycraftAPI

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

BuycraftAPI

TravisCI

BuycraftAPI brings Buycraft and Java together. This is made for developers that want to use Buycraft on their Minecraft servers that just want to show their lastest donators on signs or create cool statues without using the whole Buycraft plugin.

Installation

BuycraftAPI is distributed as a maven project. To compile it and install it in your local Maven repository (.m2) use:

git clone https://github.com/Hugmanrique/BuycraftAPI
cd BuycraftAPI
mvn clean install

Usage

To start getting some data you need to create an instance of BuycraftAPI where you have to provide your private API Server Key.

Then, you can change if you want the queries to be made via HTTPS or HTTP with BuycraftAPI.setSecure(boolean). By default the API will use HTTPS.

Now you can use all the methods inside this class. If you don't know how something works, read the Javadocs, all the methods are well documented.

The methods in this API are blocking, so that means you will have to run the methods in another Thread, or if you are using Spigot just use BukkitRunnable.runTaskAsynchronously(Plugin)

Examples

Get 10 latest people that bought a package and how much they payed:

try {
    BuycraftApi api = new BuycraftApi("YOUR_API_KEY");
    Set<Payment> latest = api.getLatestPayments(10);
    
    for (Payment payment : latest){
        System.out.println("- " + payment.getPlayerName() + " payed " + payment.getAmount() + payment.getCurrencySymbol());
    }
    
} catch (BuycraftException e) {
    e.printStackTrace();
}

Get all the Packages and display them:

try {
    BuycraftApi api = new BuycraftApi("YOUR_API_KEY");
    Set<Category> categories = api.getListing();
    
    for (Category category : categories){
        System.out.println("- " + category.getName() + " has " + category.getPackages().size() + " packages and " + category.getSubCategories().size() + " subcategories");
    }
} catch (BuycraftException e){
    e.printStackTrace();
}

License

This project is licensed under the GNU General Public License. You can read all the license terms here

Donate

If you think this project is useful for you or your server, please, consider donating here

About

Java API that makes integrating with the Buycraft Plugin API so easy!

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%