MonGen's Cave Docs
  • Welcome here!
  • Premium Products
    • mc-DiscordLink
      • Plugin FAQ
      • Commands
      • Feature Help
        • Setup Discord Bot
        • Bot Settings
        • Link System
        • Embed Builder
      • Supported Plugins
        • Rank Plugins
        • PlaceholderAPI
        • DiscordLinkProxy
        • Floodgate
      • Migrate Data
    • mc-Levels
      • Plugin FAQ
      • Commands
      • Supported Plugins
        • PlaceholderAPI
        • AxBooster
      • Developer API
    • mc-Credits
      • Plugin FAQ
      • Commands
      • Feature Help
        • GUI Options
      • Supported Plugins
        • PlaceholderAPI
      • Developer API
    • mc-Homes
      • Plugin FAQ
      • Commands
      • Feature Help
        • Safe Teleport
        • Home Name
  • Free Products
    • mc-FunGun
      • Plugin FAQ
      • Supported Plugins
      • Commands
    • mc-PlayerVisibility
      • Plugin FAQ
      • Supported Plugins
      • Commands
    • mc-IPGuard
      • Plugin FAQ
      • Supported Plugins
      • Commands
    • mc-Scheduler
      • Plugin FAQ
      • Commands
      • Supported Plugins
        • PlaceholderAPI
  • REACH US HERE
  • Discord Support
  • BuiltByBit
  • SpigotMC
  • Polymart
Powered by GitBook
On this page
  • 1) Add the Dependency
  • 2) Add mc-Levels to plugin.yml
  • 3) Example how to use the LevelsAPI
  1. Premium Products
  2. mc-Levels

Developer API

Provides an easy way to manage player levels and XP, handle level-up events, and control XP gains.

PreviousAxBoosterNextmc-Credits

Last updated 3 months ago

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>
maven { url "https://repo.mongenscave.com/releases" }

implementation "com.mongenscave:mc-LevelsAPI:[VERSION]"

2) Add mc-Levels to plugin.yml

depend:
  - mc-Levels
softdepend:
  - 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.