Skip to content

BX-Team/run-server-plugin

Repository files navigation

run-server-plugin

GitHub License GitHub top language Gradle Plugin Portal Version

Gradle plugin for running Minecraft server instances in your IDE

Installation

build.gradle

plugins {
    id 'org.bxteam.runserver' version '1.1.0'
}

build.gradle.kts

plugins {
    id("org.bxteam.runserver") version "1.1.0"
}

Usage

Basic

tasks {
    runServer {
        serverType(ServerType.PAPER)
        minecraftVersion("1.21.5")
        noGui(true)
        acceptMojangEula()

        downloadPlugins {
            url("https://download.luckperms.net/1581/bukkit/loader/LuckPerms-Bukkit-5.4.164.jar")
        }
    }
}

Advanced

tasks {
    runServer {
        // Server type and version
        serverType(ServerType.PAPER)
        minecraftVersion("1.21.5")
        
        // RAM configuration
        allowedRam(4, RamAmount.GB) // Allocate 4GB of RAM
        // or
        allowedRam(2048, RamAmount.MB) // Allocate 2048MB of RAM
        
        // GUI settings
        noGui(true) // Disable GUI (recommended for servers)
        
        // EULA acceptance
        acceptMojangEula() // Automatically accept Mojang EULA
        
        // Debug mode
        debugMessage(true) // Enable debug messages
        
        // Plugin downloads using the new DSL
        downloadPlugins {
            // Modrinth plugins
            modrinth("worldedit", "7.3.12")
            
            // GitHub releases
            github("NEZNAMY", "TAB", "5.2.0", " TAB.v5.2.0.jar ")
            
            // Hangar plugins
            hangar("squaremap", "1.3.5")
            
            // Jenkins artifacts (only latest builds)
            jenkins("https://ci.athion.net", "FastAsyncWorldEdit", Regex("Bukkit"))
            
            // Direct URL downloads
            url("https://download.luckperms.net/1581/bukkit/loader/LuckPerms-Bukkit-5.4.164.jar")
        }
        
        // Local plugin files
        // Single file
        filePlugin(File("plugins/my-plugin.jar"))
        // With overwrite option
        filePlugin(File("plugins/another-plugin.jar"), overwrite = true)
        
        // Multiple files
        filePlugins(
            File("plugins/plugin1.jar"),
            File("plugins/plugin2.jar")
        )
        
        // List of files
        filePlugins(listOf(
            File("plugins/plugin3.jar"),
            File("plugins/plugin4.jar")
        ))
        
        // List of files with overwrite option
        filePlugins(listOf(
            File("plugins/plugin5.jar") to true,  // Will overwrite
            File("plugins/plugin6.jar") to false  // Won't overwrite
        ))
        
        // Custom server folder
        serverFolderName("my-server") // Creates server in 'my-server' directory
        // or with dynamic name
        serverFolderName { "server-${minecraftVersion}-${serverType.name.lowercase()}" }
        // or with full path control
        serverFolder { File(projectDir, "servers/${minecraftVersion}/${serverType.name.lowercase()}") }
        
        // Version-specific folders
        perVersionFolder(true) // Creates separate folders for each Minecraft version
        
        // Custom input task (if you want to use a different task's output)
        inputTask(tasks.named("shadowJar")) // Use shadowJar task output instead of jar
    }
}

Supported Jar Types

We're using MCJars API to download and check the server jar. We support the following jar types:

  • Spigot
  • Paper
  • Pufferfish
  • Purpur
  • Canvas
  • DivineMC
  • Leaf
  • Leaves
  • Bungeecord
  • Velocity
  • Waterfall