-
Notifications
You must be signed in to change notification settings - Fork 0
2. Development API
Terry edited this page May 2, 2023
·
6 revisions
Welcome to the PointsAPI wiki!
Step 1: Import using maven or gradle (or manually using the PointsAPI.jar)
You can see the latest version here.
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository><dependency>
<groupId>com.github.teraprath</groupId>
<artifactId>PointsAPI</artifactId>
<version>INSERT_VERSION_HERE</version>
</dependency>repositories {
maven { url 'https://jitpack.io' }
}dependencies {
implementation 'com.github.teraprath:PointsAPI:INSERT_VERSION_HERE'
}
Step 2: Add PointsAPI as dependency in your plugin.yml:
...
depend: [ PointsAPI ]Step 4: Now initialize PointsAPI in your onEnable() method:
public final class TestPlugin extends JavaPlugin {
@Override
public void onEnable() {
new PointsAPI(this).init();
}
}Step 5: You're done.
An overview of the methods provided by the PointsAPI.
PointsAPI.getPoints(player);
PointsAPI.setPoints(player, amount);
PointsAPI.addPoints(player, amount);
PointsAPI.removePoints(player, amount);
PointsAPI.reset(player);To process tasks asynchronously, use the following method provided by the Bukkit library.
Bukkit.getScheduler().runTaskAsynchronously(plugin, task -> {
int points = PointsAPI.getPoints(player);
// do stuff
});