Purpur Documentation

repository·ver/26.2·Indexed 25 days ago

https://github.com/purpurmc/purpur

High-performance Minecraft server software designed as a drop-in replacement for Paper. Features high configurability, performance optimizations, and new gameplay features. Includes documentation on the Purpur API for Maven and Gradle, server build automation via Gradle, and custom server commands such as /compass, /credits, and /tpsbar.

Tokens
3.8K
Snippets
12
Records
28
Agent score
82%

What's inside Purpur

  1. Install Purpur dependencies to local Maven repository

    ver/26.2

    To install the purpur-api and purpur dependencies into your local Maven repository (useful for local development of other projects that depend on Purpur), run the following command.

    ./gradlew publishToMavenLocal
  2. Compile the API and server

    ver/26.2

    To build the API and server components, use the ./gradlew build command.

    Note: The resulting JARs are for development/reference and are not used to start a server.

    • API JARs: Located in purpur-api/build/libs
    • Server JARs: Located in purpur-server/build/libs
    ./gradlew build
  3. Initial setup for development

    ver/26.2

    To set up the Purpur development environment, you must first clone the repository (do not download it as a ZIP). Once cloned, run the following command in the root directory to apply all necessary patches. After this step, the project is ready to be opened in your IDE.

    ./gradlew applyAllPatches
  4. Download Purpur server builds

    ver/26.2

    Purpur builds can be obtained via the official downloads page or through the Downloads API. Use the API to programmatically retrieve version lists, specific builds, or the latest available build for a Minecraft version.

    API Endpoints:

    • List Minecraft versions with available builds: https://api.purpurmc.org/v2/purpur
    • List builds for a specific Minecraft version: https://api.purpurmc.org/v2/purpur/<version>
    • Download a specific build: https://api.purpurmc.org/v2/purpur/<version>/<build>/download
    • Download the latest build for a version: https://api.purpurmc.org/v2/purpur/<version>/latest/download
  5. Add Purpur API to Maven or Gradle projects

    ver/26.2

    To use the Purpur API in your development environment, add the Purpur snapshot repository and the purpur-api dependency to your build configuration. The Purpur API includes all APIs provided by Paper, Spigot, and Bukkit.

    Maven Configuration:

    <repository>
        <id>purpur</id>
        <url>https://repo.purpurmc.org/snapshots</url>
    </repository>
    <dependency>
        <groupId>org.purpurmc.purpur</groupId>
        <artifactId>purpur-api</artifactId>
        <version>[26.2.build,)</version>
        <scope>provided</scope>
    </dependency>

    Gradle Configuration:

    repositories {
        maven("https://repo.purpurmc.org/snapshots")
    }
    dependencies {
        compileOnly("org.purpurmc.purpur:purpur-api:26.2.build.+")
    }
    <repository>
        <id>purpur</id>
        <url>https://repo.purpurmc.org/snapshots</url>
    </repository>
  6. Compile a server-ready purpurclip jar

    ver/26.2

    To create a JAR that is ready to be used to run a server, run the following command. The resulting purpurclip jar will be located in purpur-server/build/libs.

    ./gradlew createMojmapBundlerJar
  7. Hide hidden players from entity selectors

    ver/26.2

    Purpur includes a feature that allows server administrators to prevent players from being targeted by entity selectors (used in commands like /tp, /kill, or /effect) if they are not visible to the command sender.

    This behavior is controlled by the hideHiddenPlayersFromEntitySelector configuration setting. When enabled, if a player is hidden (e.g., via invisibility or other mechanics that make them unseeable to the sender), they will be excluded from the results of entity selector arguments in commands.

  8. Configure Purpur command registration

    ver/26.2

    Purpur provides configuration options to control the registration of certain Minecraft commands that are otherwise disabled or reserved for debugging. These settings are managed via org.purpur.PurpurConfig.

    • registerMinecraftDisabledCommands: When enabled, allows the registration of commands that are normally disabled in standard Minecraft (e.g., ChaseCommand).
    • registerMinecraftDebugCommands: When enabled, allows the registration of Minecraft debug commands (e.g., RaidCommand, DebugPathCommand, DebugMobSpawningCommand).
  9. Toggle item drops for the /give command

    ver/26.2

    Purpur provides a configuration option to control whether items granted via the /give command are dropped on the ground if the player's inventory is full. By default, if an item cannot be added to the inventory, it is dropped as an item entity. You can disable this behavior using the disableGiveCommandDrops configuration key.

    PurpurConfig.disableGiveCommandDrops
  10. Configure unsafe enchantment levels via PurpurConfig

    ver/26.2

    By default, the /enchant command prevents users from applying enchantment levels higher than the enchantment's defined maximum level or applying incompatible enchantments.

    Purpur provides a configuration option allowUnsafeEnchantCommand to bypass these restrictions. When enabled, the /enchant command will allow:

    1. Enchantment levels exceeding the standard maxLevel.
    2. Enchantments that are otherwise incompatible with the item's current enchantment set.
  11. Configure extra permissions for the /gamemode command

    ver/26.2

    Purpur provides an additional permission layer for the /gamemode command. When commandGamemodeRequiresPermission is enabled in the Purpur configuration, players must possess specific permissions to change their game mode or the game mode of others.

    To change to a specific game mode, the player needs: minecraft.command.gamemode.<mode> (e.g., minecraft.command.gamemode.creative)

    To change the game mode of other players, the player needs an additional permission: minecraft.command.gamemode.<mode>.other (e.g., minecraft.command.gamemode.creative.other)

    Note: These permissions are only checked if commandGamemodeRequiresPermission is set to true in the Purpur configuration.

  12. Test Bukkit permissions in CommandSourceStack

    ver/26.2

    The testPermission method allows checking for both Minecraft native permissions and legacy Bukkit-style permission strings. If the permission check fails, it attempts to send a formatted failure message to the command source, replacing the <permission> placeholder with the actual Bukkit permission string provided.

    public boolean testPermission(net.minecraft.server.permissions.Permission permission, String bukkitPermission)