Skip to content

Public API Methods

This page documents the public methods on NexoriMinigameApi. Each method is intentionally narrow: query match state, set player state, return a player, or submit the final result.

Match Lookup

findActiveMatchId

java
Optional<String> findActiveMatchId(UUID playerUuid)
ArgumentMeaning
playerUuidPlayer UUID to check.

Returns the active Nexori match id for the player, or Optional.empty() if the player is not currently in an active Nexori match.

Call this as the first gate before your tick/event logic touches a player.

java
Optional<String> activeMatchId = nexoriApi.findActiveMatchId(playerUuid);
if (activeMatchId.isEmpty()) {
    return;
}
String matchId = activeMatchId.get();

findActivePlayerUuid

java
Optional<UUID> findActivePlayerUuid(String matchId, String playerToken)
ArgumentMeaning
matchIdActive Nexori match id.
playerTokenPlayer UUID string or current username.

Returns a player UUID inside the active match. Username matching is case-insensitive.

Call this when a command or UI event gives your mod player text instead of a UUID.

java
UUID targetUuid = nexoriApi.findActivePlayerUuid(matchId, inputText).orElse(null);
if (targetUuid == null) {
    return;
}

Match Snapshot

findActiveMatchInfo

java
Optional<NexoriActiveMatchInfo> findActiveMatchInfo(String matchId)
ArgumentMeaning
matchIdActive Nexori match id.

Returns the public runtime snapshot for the match.

Call this when creating or refreshing your own match runtime.

java
NexoriActiveMatchInfo info = nexoriApi.findActiveMatchInfo(matchId).orElse(null);
if (info == null) {
    return;
}

if (!"capture_the_zone".equals(info.rulesEngineId())) {
    return;
}

NexoriActiveMatchInfo includes:

FieldMeaning
matchIdLocal Nexori match id.
queueIdQueue that launched or owns the match.
arenaIdArena/game id.
assignmentIdBackend assignment id, when available.
externalMatchIdBackend-owned match id, when available.
rulesEngineIdRules mod id that should control the match. Non-blank means rules-mod ownership in the recommended flow.
matchResolutionTriggerIdResolution trigger configured for the arena. Useful for diagnostics and legacy/advanced flows.
expectedPlayerUuidsPlayers expected by launch context.
arrivedPlayerUuidsPlayers that reached the arena runtime.
activePlayerUuidsPlayers still active in the match runtime.
eliminatedPlayerUuidsPlayers marked eliminated by Nexori/runtime state.
spectatorPlayerUuidsPlayers marked as logical spectators.
requiredResultPlayerUuidsPlayers that must have an outcome before final submit.
playerOutcomesAccumulated outcome states set by setPlayerOutcome(...).
expectedPlayerCountExpected player count.
completedAtEpochMsLocal completion time, or 0.
resultSubmittedAtEpochMsAccepted result submit time, or 0.

findRulesEngineId

java
Optional<String> findRulesEngineId(String matchId)
ArgumentMeaning
matchIdActive Nexori match id.

Returns the rules engine id for the match.

Call this if you only need ownership and do not need the full NexoriActiveMatchInfo snapshot. In the recommended setup, this is the main ownership gate for a rules mod.

java
boolean ownedByThisMod = nexoriApi.findRulesEngineId(matchId)
    .filter("skywars"::equals)
    .isPresent();

findMatchResolutionTriggerId

java
Optional<String> findMatchResolutionTriggerId(String matchId)
ArgumentMeaning
matchIdActive Nexori match id.

Returns the active match resolution trigger id. none or blank means manual/custom resolution.

Most rules mods should not need this for normal ownership checks. Use rulesEngineId instead. This method is useful for diagnostics, admin tools, legacy integrations, or advanced flows that need to show which arena resolver is configured.

java
String triggerId = nexoriApi.findMatchResolutionTriggerId(matchId).orElse("");
logger.atInfo().log("Match " + matchId + " trigger=" + triggerId);

findMatchPlacementState

java
Optional<NexoriMatchPlacementState> findMatchPlacementState(String matchId)
ArgumentMeaning
matchIdActive Nexori match id.

Returns Nexori's initial placement snapshot.

Call this before enabling position-sensitive gameplay.

java
NexoriMatchPlacementState placement = nexoriApi.findMatchPlacementState(matchId).orElse(null);
if (placement == null || !placement.placementComplete()) {
    return;
}

NexoriMatchPlacementState:

FieldMeaning
expectedPlayersPlayers Nexori expects for the match.
arrivedPlayersPlayers that arrived at the arena runtime.
placedPlayersPlayers that completed initial placement.
placementCompletetrue once initial placement is complete.

findMatchResultRequirements

java
Optional<NexoriMatchResultRequirements> findMatchResultRequirements(String matchId)
ArgumentMeaning
matchIdActive Nexori match id.

Returns the player set required for final result completeness.

Call this when preparing to finalize a match.

java
NexoriMatchResultRequirements requirements =
    nexoriApi.findMatchResultRequirements(matchId).orElse(null);
if (requirements == null) {
    return;
}

for (UUID playerUuid : requirements.requiredPlayerUuids()) {
    // Make sure each player has an accumulated WIN, LOSS, or DISCONNECTED outcome.
}

Required players are derived like this:

ConditionRequired set
expectedPlayerUuids is not emptyexpectedPlayerUuids
expectedPlayerUuids is emptyarrived + active + eliminated, without duplicates

Player State

setPlayerOutcome

java
NexoriSetPlayerOutcomeResult setPlayerOutcome(
    String matchId,
    UUID playerUuid,
    NexoriMatchResultPlayerOutcome outcome,
    String reason
)
ArgumentMeaning
matchIdActive Nexori match id.
playerUuidPlayer receiving the outcome.
outcomeWIN, LOSS, or DISCONNECTED.
reasonShort player-level reason.

Stores or replaces one player's accumulated outcome inside the active match runtime.

Call this when your rules mod decides a player's competitive state changed.

java
NexoriSetPlayerOutcomeResult result = nexoriApi.setPlayerOutcome(
    matchId,
    eliminatedPlayerUuid,
    NexoriMatchResultPlayerOutcome.LOSS,
    "fell_into_void"
);

if (result.status() != NexoriSetPlayerOutcomeStatus.UPDATED) {
    logger.atWarning().log("Could not store outcome: " + result.message());
}

Notes:

RuleBehavior
Repeated calls before completionThe latest outcome replaces the previous one.
WINDoes not mark the player eliminated.
LOSS or DISCONNECTEDMarks the player eliminated.
Completed matchReturns MATCH_ALREADY_COMPLETED.
Return-to-lobbyNot triggered by this method.
Backend reportingNot triggered by this method.

Status values:

ValueMeaning
UPDATEDOutcome was stored.
MATCH_MISSINGMatch does not exist.
PLAYER_MISSINGPlayer does not belong to the match.
MATCH_ALREADY_COMPLETEDMatch was already completed.
INVALID_OUTCOMEOutcome was invalid.
INVALID_REASONReason failed validation.

setPlayerSpectator

java
NexoriSetPlayerSpectatorResult setPlayerSpectator(
    String matchId,
    UUID playerUuid,
    boolean spectator,
    String reason
)
ArgumentMeaning
matchIdActive Nexori match id.
playerUuidPlayer to update.
spectatortrue to mark spectator, false to clear it.
reasonShort reason for logs/debugging.

Stores logical spectator state for one player.

Call this when your rules mod wants Nexori to know that a player is still in the match context but no longer actively playing.

java
nexoriApi.setPlayerSpectator(
    matchId,
    playerUuid,
    true,
    "eliminated_can_watch"
);

This is logical state only. It does not promise camera mode, invisibility, noclip, teleporting, or visual spectator controls.

Status values:

ValueMeaning
UPDATEDSpectator state was stored.
MATCH_MISSINGMatch does not exist.
PLAYER_MISSINGPlayer does not belong to the match.
MATCH_ALREADY_COMPLETEDMatch was already completed.
INVALID_REASONReason failed validation.

Player Return

returnPlayerToLobby

java
NexoriReturnPlayerResult returnPlayerToLobby(
    String matchId,
    UUID playerUuid,
    int delaySeconds,
    String reason
)
ArgumentMeaning
matchIdActive Nexori match id.
playerUuidPlayer to return.
delaySecondsDelay before return.
reasonShort return reason.

Schedules one player through Nexori's return-to-lobby flow.

Call this when your game wants one player, or all players in a loop, to leave the arena.

java
for (UUID playerUuid : requirements.requiredPlayerUuids()) {
    nexoriApi.returnPlayerToLobby(
        matchId,
        playerUuid,
        5,
        "match_completed"
    );
}

This method only handles transport/return. It does not set outcomes, complete the match, or report results.

Status values:

ValueMeaning
SCHEDULEDReturn was scheduled.
MATCH_MISSINGMatch does not exist.
PLAYER_MISSINGPlayer does not belong to the match.
INVALID_DELAYDelay was invalid.
INVALID_REASONReason failed validation.

Final Result

submitFinalMatchResult

java
NexoriSubmitFinalMatchResultResult submitFinalMatchResult(
    NexoriSubmitFinalMatchResultRequest request
)

Request:

java
public record NexoriSubmitFinalMatchResultRequest(
    String matchId,
    String reason,
    JsonObject customData
) {
}
FieldMeaning
matchIdActive Nexori match id to complete.
reasonMatch-level completion reason.
customDataMinigame-owned JSON object forwarded to result reporting.

Completes the match locally using accumulated player outcomes from setPlayerOutcome(...).

Call this once, after every required result player has an outcome.

java
JsonObject customData = new JsonObject();
customData.addProperty("mode", "mid_capture");
customData.addProperty("capturePointId", "mid");

JsonObject progressByPlayer = new JsonObject();
progressByPlayer.add(winnerUuid.toString(), winnerProgressJson);
customData.add("playerCaptureProgress", progressByPlayer);

NexoriSubmitFinalMatchResultResult result = nexoriApi.submitFinalMatchResult(
    new NexoriSubmitFinalMatchResultRequest(
        matchId,
        "mid_capture_point_captured",
        customData
    )
);

Nexori validates:

RuleBehavior
Match existsMissing match returns MATCH_MISSING.
Match not already finalizedSame payload is idempotent; different payload is a duplicate conflict.
CompletenessEvery required player must have an accumulated outcome.
Unknown outcomesOutcomes for players outside the match are rejected.
WinnerV1 requires at least one WIN.
Custom dataMust be a valid JSON object within limits.

Result:

FieldMeaning
matchStatusLocal match completion status.
backendReportStatusBackend reporting status, separate from local completion.
resultIdDurable result id when backend reporting was queued or matched.
messageHuman-readable detail for logs.

submitFinalMatchResult(...) does not return players to lobby. Use returnPlayerToLobby(...) separately.

Custom Data Limits

customData is owned by the rules mod. Nexori validates it and forwards it to /nexori/results when reporting is enabled.

LimitValue
Root typeJsonObject
null custom dataTreated as {}
Serialized UTF-8 size32 KiB
Max depth8
Total properties256
Array length128
Property name64 characters
String value1024 characters

Nexori rejects invalid custom data instead of silently truncating it.

Legacy Methods

submitMatchResult

java
@Deprecated
NexoriSubmitMatchResultResult submitMatchResult(NexoriSubmitMatchResultRequest request)

Legacy complete-result method that receives the player outcome list inside the request.

Existing mods may continue to use it. New mods should prefer setPlayerOutcome(...) plus submitFinalMatchResult(...).

resolvePlayerOutcome

java
@Deprecated
NexoriResolvePlayerResult resolvePlayerOutcome(
    String matchId,
    UUID playerUuid,
    NexoriPlayerResolutionOutcome outcome,
    int returnDelaySeconds,
    String reason
)

Legacy per-player method that sets one outcome and schedules that player's return.

Existing mods may continue to use it. New mods should keep outcome and return separate with setPlayerOutcome(...) and returnPlayerToLobby(...).