This guide helps you upgrade your plugins and integrations from Realms API 3.x to 4.0.1.
4.0.1 introduces SemVer versioning, new events, enum-based language handling, and record-based models. Several breaking API changes are listed below with concrete before/after examples.
Moved from ...world to ...enums:
de.cytooxien.realms.api.world.WorldRule→de.cytooxien.realms.api.enums.WorldRulede.cytooxien.realms.api.world.WorldPreset→de.cytooxien.realms.api.enums.WorldPreset
Before (3.x):
String lang = playerInfo.language(playerId);
if ("DE".equalsIgnoreCase(lang)) { ... }After (4.0.1):
import de.cytooxien.realms.api.enums.Language;
Language lang = playerInfo.language(playerId);
if (lang == Language.DE) { ... }- Removed:
RealmInformationProvider.boostsByPlayer(UUID) - New:
PlayerInformationProvidernow provides player-specific boost access:
Action<Integer> count = playerInfo.boostCount(playerId);
Action<List<Boost>> list = playerInfo.boosts(playerId);The realm-wide int boostCount() on RealmInformationProvider remains unchanged.
Group, Limits, DefinedWorld, and Boost are records. JavaBean-style getters are removed. Use record component accessors.
Examples:
group.getName()→group.name()limits.getMaxPlayers()→limits.maxPlayers()definedWorld.getWorldFolder()→definedWorld.worldFolder()
Factory methods like Group.create(...) and DefinedWorld.create(...) remain and return records.
- New record:
Boost(UUID playerId, long expireTimestamp, int amount) - Field rename:
expireDate→expireTimestamp(Unix epoch seconds) - Collections:
Boost[]→List<Boost>
Example:
Boost boost = ...;
UUID id = boost.playerId();
int amount = boost.amount();
Instant expiry = Instant.ofEpochSecond(boost.expireTimestamp());Register listeners as usual and consume the new events:
@EventHandler
public void onBoost(RealmBoostEvent e) {
int amount = e.getBoostAmount();
long expires = e.getExpireTimestamp();
}
@EventHandler
public void onJoin(RealmPlayerJoinEvent e) {
JoinReason reason = e.getJoinReason();
}
@EventHandler
public void onLanguage(RealmPlayerLanguageChangeEvent e) {
Language oldLang = e.getOldLanguage();
Language newLang = e.getNewLanguage();
}
@EventHandler
public void onPrePause(RealmPrePauseEvent e) { /* ... */ }
@EventHandler
public void onPostPause(RealmPostPauseEvent e) { /* ... */ }- Update dependency coordinates to JitPack and version
4.0.1. - Replace imports of
WorldRule/WorldPresetto...enums. - Change
language(UUID)usage toLanguageenum. - Replace
boostsByPlayer(...)withPlayerInformationProvider.boostCount(...)/boosts(...). - Update model access to record component methods (no JavaBean getters).
- Adjust any
Boosthandling toexpireTimestamp(epoch seconds) andList<Boost>. - Build against minimum Paper 1.21.1 and Java 21.
If you run into anything not covered here, please open an issue with code examples so we can extend this guide.