Challenges add-on
Purchase Challenges add-on
  • GET A COPY
    • Purchase Challenges add-on
  • GENERAL
    • Home
  • Get Started
    • Installing add-on
      • 🛏️Bed Wars Core
      • 🔑License Key
      • 🪅Integrations
      • ⌨️Commands & Permissions
      • 💾Database
    • Challenge Types
  • DEVELOPER API
    • API Hook-up
    • Custom Events
Powered by GitBook
On this page
  • Registering the API in your project
  • Obtaining and using the API

Was this helpful?

  1. DEVELOPER API

API Hook-up

Easy to understand and use

PreviousChallenge TypesNextCustom Events

Last updated 3 months ago

Was this helpful?

Ask for the API .jar file from .

Registering the API in your project

First you need to create a folder in the main path of your project and store the .jar file there.

Maven

Replace libs with the name of the directory where the .jar file is stored and replace API.jar with the name of the .jar file.

<dependency>
  <groupId>com.reussy.development.challenges</groupId>
  <artifactId>api</artifactId>
  <version>1.0.0-BETA</version> 
  <scope>system</scope>
  <systemPath>${project.basedir}\libs\Challenges-API.jar</systemPath>
</dependency>

Gradle

Replace libs with the name of the directory where the .jar file is stored and replace API.jar with the name of the .jar file.

implementation fileTree(include: ['Challenges-API.jar'], dir: 'libs')

Obtaining and using the API

To obtain the API class we make use of the service provided by Bukkit to register a class and retrieve it using #getRegistration method.

Retrieving the service

ChallengesAPI challengesAPI = Bukkit.getServicesManager().getRegistration(ChallengesAPI.class).getProvider();

Change challenge wins

UUID uuid = player.getUniqueId();
IUser user = challengesAPI.getUserUtil().getUser(uuid);
IChallenge challenge = challengesAPI.getChallengesUtil().getChallenge(@NotNull String id);
IChallengeUser challengeUser = challengesAPI.getChallengesUtil().getUserChallenge(user, challenge)

challengeUser.setChallengeWins(2);
here