Skip to main content

Developer API

ArenaPvP exposes a public Java API that other plugins can use to query player state, arena information, queue status, and leaderboards.

info

Group management is handled by the GroupManager plugin, which has its own separate API. See the GroupManager integration page for details.

Getting Started

Add ArenaPvP's jar as a compileOnly dependency:

build.gradle.kts
dependencies {
compileOnly(files("libs/arenapvp.jar"))
}

All public types live under com.arenapvp.api:

InterfaceDescription
ArenaPvPAPIMain entry point — provides sub-managers
ArenaPvPProviderStatic provider to obtain the API instance
PlayerManagerPlayer state queries
ArenaManagerArena instance queries
QueueManagerMatchmaking queue queries
LeaderboardManagerStatistics, ratings, and rankings

Obtaining the API

import com.arenapvp.api.ArenaPvPAPI;
import com.arenapvp.api.ArenaPvPProvider;

// Safe access (recommended)
if (ArenaPvPProvider.isAvailable()) {
ArenaPvPAPI api = ArenaPvPProvider.get();
// use the API
}

// Direct access — throws IllegalStateException if not loaded
ArenaPvPAPI api = ArenaPvPProvider.get();
tip

Cache the ArenaPvPAPI reference — the instance doesn't change during server lifetime.


PlayerManager

Queries about individual player state. All methods take a UUID.

MethodReturnsDescription
isInArena(UUID)booleanPlayer is inside an arena match
isInQueue(UUID)booleanPlayer is in a matchmaking queue
isInPendingMatch(UUID)booleanMatch found, waiting for instance
isSpectator(UUID)booleanPlayer is spectating
isExternalSpectator(UUID)booleanSpectating without being a participant
isInTransfer(UUID)booleanBeing teleported in/out of arena
isInGroup(UUID)booleanBelongs to a group (requires GroupManager)
isBusy(UUID)booleanIn arena, queue, pending, or transfer
getArenaInstanceId(UUID)Optional<UUID>Instance ID if in an arena
getQueueCategory(UUID)Optional<String>Category code if in a queue
PlayerManager pm = api.getPlayerManager();

if (pm.isBusy(playerUuid)) {
// Don't teleport or interact
return;
}

pm.getArenaInstanceId(playerUuid).ifPresent(id -> {
System.out.println("In arena: " + id);
});

ArenaManager

Read-only queries about active arena instances.

MethodReturnsDescription
getActiveInstances()Collection<ArenaSnapshot>All active instances
getInstanceById(UUID)Optional<ArenaSnapshot>Instance by ID
getInstanceByPlayer(UUID)Optional<ArenaSnapshot>Instance containing a player
getTotalPlayersInArenas()intTotal players across all arenas
getActiveInstanceCount()intNumber of active instances
getActiveInstanceCountByCategory(String)intActive instances in a category
hasActiveInstances()booleanWhether any instance is active
ArenaManager am = api.getArenaManager();

am.getInstanceByPlayer(playerUuid).ifPresent(snapshot -> {
System.out.println("Arena: " + snapshot.getArenaName());
System.out.println("Type: " + snapshot.getArenaType());
System.out.println("Players: " + snapshot.getPlayerCount() + "/" + snapshot.getMaxPlayers());
});

QueueManager

Read-only queries about matchmaking state.

MethodReturnsDescription
getQueueSize()intTotal groups in all queues
getQueueSizeByCategory(String)intGroups in queue for a category
getPendingMatchCount()intMatches waiting for instance creation
isPlayerInQueue(UUID)booleanPlayer is in any queue
isPlayerInPendingMatch(UUID)booleanPlayer has a pending match

LeaderboardManager

Statistics, ratings, and ranking queries by arena category. New players have a default rating of 1000.

MethodReturnsDescription
getRating(String category, UUID)intPlayer rating (default: 1000)
getStats(String category, UUID)Optional<PlayerStats>Player stats in a category
getTotalStats(UUID)TotalStatsAggregated stats across all categories
getTopByRating(String category, int limit)List<PlayerStats>Top players (limit: 1–100)
LeaderboardManager lb = api.getLeaderboardManager();

int rating = lb.getRating("2-FFA", playerUuid);

lb.getStats("2-FFA", playerUuid).ifPresent(stats -> {
System.out.println("K/D: " + stats.getKdRatio());
System.out.println("W/L: " + stats.getWlRatio());
});

List<LeaderboardManager.PlayerStats> top = lb.getTopByRating("2-FFA", 10);
for (int i = 0; i < top.size(); i++) {
var s = top.get(i);
System.out.println((i + 1) + ". " + s.getDisplayName() + " — " + s.getRating());
}

Data Types

All returned objects are immutable snapshots — they represent state at the moment of the query.

ArenaSnapshot

MethodTypeDescription
getInstanceId()UUIDInstance identifier
getArenaName()StringTemplate name
getCategoryCode()StringCategory (e.g. "2-FFA")
getArenaType()StringType (e.g. "FFA", "TDM")
getMaxPlayers()intMax players
getPlayerUuids()Collection<UUID>All player UUIDs
getTeam1Uuids()Collection<UUID>Team 1 UUIDs
getTeam2Uuids()Collection<UUID>Team 2 UUIDs
getAlivePlayerUuids()Collection<UUID>Alive players
getPlayerCount()intCurrent player count
isMatchStarted()booleanMatch has started
isActive()booleanInstance is active
isDeathmatch()booleanDeathmatch mode
isCaptureMode()booleanCapture (TCTO) mode
isTeamBased()booleanTeam-based arena
getWorldName()StringWorld name (may be null)

PlayerStats

MethodTypeDescription
getPlayerId()UUIDPlayer UUID
getDisplayName()StringPlayer name
getKills()intKills
getDeaths()intDeaths
getWins()intWins
getLosses()intLosses
getRating()intRating
getKdRatio()doubleKill/death ratio
getWlRatio()doubleWin/loss ratio
getLastUpdated()longLast update (epoch millis)

TotalStats

MethodTypeDescription
getKills()intTotal kills across all categories
getDeaths()intTotal deaths
getWins()intTotal wins
getLosses()intTotal losses
getKdRatio()doubleGlobal K/D ratio
getWlRatio()doubleGlobal W/L ratio

Thread Safety

  • All query methods are safe to call from any thread.
  • Returned snapshot objects are fully immutable — safe to cache or pass between threads.

Full Example

import com.arenapvp.api.*;

public class MyPlugin {

private ArenaPvPAPI arenaApi;

public void onEnable() {
if (!ArenaPvPProvider.isAvailable()) {
System.out.println("ArenaPvP is not available!");
return;
}

arenaApi = ArenaPvPProvider.get();
System.out.println("Connected to ArenaPvP API");
}

public void showPlayerInfo(UUID playerUuid) {
PlayerManager players = arenaApi.getPlayerManager();

if (players.isBusy(playerUuid)) {
System.out.println("Player is busy");

players.getArenaInstanceId(playerUuid).ifPresent(instanceId -> {
arenaApi.getArenaManager()
.getInstanceById(instanceId)
.ifPresent(arena -> {
System.out.println("Arena: " + arena.getArenaName());
System.out.println("Mode: " + arena.getArenaType());
});
});
}

// Rating
int rating = arenaApi.getLeaderboardManager().getRating("2-FFA", playerUuid);
System.out.println("2v2 FFA Rating: " + rating);

}

public void showServerStats() {
ArenaManager arenas = arenaApi.getArenaManager();
QueueManager queues = arenaApi.getQueueManager();

System.out.println("Active arenas: " + arenas.getActiveInstanceCount());
System.out.println("Players fighting: " + arenas.getTotalPlayersInArenas());
System.out.println("Players in queue: " + queues.getQueueSize());
}
}

Package Structure

com.arenapvp.api
├── ArenaPvPAPI.java # Main entry point
├── ArenaPvPProvider.java # Static provider
├── PlayerManager.java # Player state queries
├── ArenaManager.java # Arena instance queries
├── QueueManager.java # Queue state queries
├── LeaderboardManager.java # Stats, ratings & rankings
└── impl/ # Internal — do not depend on
warning

Only depend on interfaces in com.arenapvp.api. The impl package is internal and subject to change.