Skip to content

Developer Info

AzureDoom edited this page Jan 17, 2026 · 5 revisions

This page explains how to include LevelingCore as a dependency in your Hytale plugin using Gradle and the AzureDoom Maven repository.

Adding the Maven Repository

LevelingCore is hosted on the AzureDoom Maven repository. Add the following repository block to your build.gradle file:

repositories {
    maven {
        name = "azuredoomMods"
        url = uri("https://maven.azuredoom.com/mods")
    }
}

Adding LevelingCore as a Dependency

Once the repository is added, include LevelingCore as a dependency:

dependencies {
    implementation("com.azuredoom.levelingcore:LevelingCore:0.+")
}

Now in your mods/plugins manifest.json add "levelingcore:LevelingCore": "*" to either Dependencies to set as hard or OptionalDependencies if you are adding integration!

Using the API

LevelingCore exposes its API through LevelingCoreApi.

Because LevelingCore may or may not be started correctly on the server, the API is accessed safely using Optional.

Accessing the Level Service

To access the level service, call:

LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
    // Use the LevelService here
});

Common Usage Examples

Below are some common operations you can perform using the LevelService.

Getting Player Level and XP

UUID playerId = player.getUniqueId();

LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
    int level = levelService.getLevel(playerId);
    long xp = levelService.getXp(playerId);
});

Adding or Removing XP

LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
    levelService.addXp(playerId, 250);
    levelService.removeXp(playerId, 100);
});

XP changes automatically trigger:

  • XP gain/loss events
  • Level up/down events (if applicable)

Setting XP or Level Directly

LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
    levelService.setXp(playerId, 5000);
    levelService.setLevel(playerId, 10);
});

⚠️ Levels are clamped to a minimum of 1.

Adding or Removing Levels

LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
    levelService.addLevel(playerId, 2);
    levelService.removeLevel(playerId, 1);
});

Listening to Level & XP Events

You can register listeners to react to player progression events.

Level Up /Down Listeners

levelService.registerLevelUpListener((playerId, newLevel) -> {
    // Handle level up
});

levelService.registerLevelDownListener((playerId, newLevel) -> {
    // Handle level down
});

XP Gain / Loss Listeners

levelService.registerXpGainListener((playerId, amount) -> {
    // Handle XP gain
});

levelService.registerXpLossListener((playerId, amount) -> {
    // Handle XP loss
});

⚠️ Listener getter methods are provided for advanced integrations and debugging. Most plugins should only register listeners and should not modify listener lists directly.

Support

If you encounter issues or have feature requests, please open an issue here.