Developer API
Provides an easy way to manage player levels and XP, handle level-up events, and control XP gains.
1) Add the Dependency
Don't forget to change always the version!
<repository>
<id>MonGens-Cave</id>
<url>https://repo.mongenscave.com/releases<repository></url>
</repository>
<dependency>
<groupId>com.mongenscave</groupId>
<artifactId>mc-LevelsAPI</artifactId>
<version>[VERSION]</version>
</dependency>
2) Add mc-Levels to plugin.yml
depend:
- mc-Levels
3) Example how to use the LevelsAPI
As an example, give XP to a player.
public class XPExample {
public void giveXP(Player player, int amount) {
LevelsAPI.getInstance().addXP(player, amount);
player.sendMessage("✅ " + amount + " You got XP!");
}
}
Event
Description
PlayerGainXPEvent
Triggered when a player gains XP. Can be modified or canceled.
PlayerLevelUpEvent
Fired when a player levels up.
Last updated