-
Notifications
You must be signed in to change notification settings - Fork 3
Developer Info
This page explains how to include LevelingCore as a dependency in your Hytale plugin using Gradle and the AzureDoom 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")
}
}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!
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.
To access the level service, call:
LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
// Use the LevelService here
});Below are some common operations you can perform using the LevelService.
UUID playerId = player.getUniqueId();
LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
int level = levelService.getLevel(playerId);
long xp = levelService.getXp(playerId);
});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)
LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
levelService.setXp(playerId, 5000);
levelService.setLevel(playerId, 10);
});
⚠️ Levels are clamped to a minimum of 1.
LevelingCoreApi.getLevelServiceIfPresent().ifPresent(levelService -> {
levelService.addLevel(playerId, 2);
levelService.removeLevel(playerId, 1);
});You can register listeners to react to player progression events.
levelService.registerLevelUpListener((playerId, newLevel) -> {
// Handle level up
});
levelService.registerLevelDownListener((playerId, newLevel) -> {
// Handle level down
});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.
If you encounter issues or have feature requests, please open an issue here.