Skip to content
MKI edited this page Oct 18, 2026 · 2 revisions

API overview

PartyLink has a public API in the package com.mki.partylink.api (server) and com.mki.partylink.api.client (client). Everything outside these packages is internal and can change in any version.

Class Side Purpose
PartyLinkApi server Queries, party control, custom party data
PartyLinkEvents server Notifications and cancellable ALLOW_* events
PartyView / PartySnapshot server Read-only, immutable copy of a party
PartyRole, PartyShareMode, PartyPingType, PartyActionResult, PartyDamageDecision, PartyPing, PartyXpShareContext both Value types
PartyLinkClientApi client Party data on the client, ping/update events, HUD lines

The API is identical on Fabric, Forge and NeoForge and on all Minecraft versions (only Minecraft's own classes like ServerPlayer and Component differ between Minecraft versions).

API versions

PartyLinkApi.API_VERSION PartyLink Added
1 1.0 – 1.1 queries, 8 notification events
2 1.2 party control, offline queries, custom data, cancellable events, client API
3 2.0 client HUD API: hide the HUD, HUD position, HUD enabled, accent color (see Client API)

Methods added in version 2 are marked @since 2 in the Javadoc, the client HUD methods of version 3 say since API version 3. If you support older PartyLink versions, check the version first:

if (PartyLinkApi.API_VERSION >= 2) {
    PartyLinkApi.setPartyData(server, party.id(), "mymod:score", "10");
}

Adding PartyLink to your project

PartyLink is an optional dependency for most mods. Compile against the PartyLink jar that matches your loader and Minecraft version, for example by putting it into a libs folder:

Fabric (Loom)

dependencies {
    modCompileOnly files("libs/partylink-fabric-26.3-2.0.0.jar")
    // for testing in your dev client:
    // modLocalRuntime files("libs/partylink-fabric-26.3-2.0.0.jar")
}

Forge / NeoForge (ModDevGradle, ForgeGradle)

dependencies {
    compileOnly files("libs/partylink-neoforge-26.3-2.0.0.jar")
}

Declare PartyLink as an optional dependency in your mod metadata (suggests in fabric.mod.json, type="optional" in neoforge.mods.toml / mandatory=false in mods.toml).

Optional integration pattern

Only touch PartyLink classes when PartyLink is loaded, and keep all PartyLink calls in a separate class, so your mod still works without it:

// Fabric
boolean partyLinkLoaded = FabricLoader.getInstance().isModLoaded("partylink");
// Forge / NeoForge
boolean partyLinkLoaded = ModList.get().isLoaded("partylink");

if (partyLinkLoaded) {
    MyPartyLinkCompat.init();   // the only class that imports com.mki.partylink.api
}
public final class MyPartyLinkCompat {
    public static void init() {
        PartyLinkEvents.MEMBER_JOINED.register((party, memberId) -> { /* ... */ });
    }

    public static List<ServerPlayer> teammates(ServerPlayer player) {
        return PartyLinkApi.getOnlinePartyMembers(player);
    }
}

Threading and rules

  • Call the server API on the server thread only (commands, tick events, other server events are fine).
  • PartyView objects are snapshots. Fetch a new one after you changed something.
  • Methods that change parties send the same chat messages and fire the same events as the matching commands.
  • Changing methods return a PartyActionResult instead of throwing:
Result Meaning
SUCCESS done
NOT_IN_PARTY the player is not in a (this) party
ALREADY_IN_PARTY the player is already in this party / a party
NOT_FOUND no such party, member or request
PARTY_FULL maxPartySize reached
NO_PERMISSION the acting player lacks the role
DISABLED the feature is turned off in the config
INVALID bad argument (self-invite, taken name, bad data key, …)
CANCELLED an ALLOW_* listener cancelled it

Example: Solo Mining

Solo Mining uses PartyLinkApi.getOnlinePartyMembers to let party members enter each other's gates and PartyLinkApi.areInSameParty to group players. These API 1 methods work unchanged in 1.2 and 2.0.

Clone this wiki locally