Skip to content

Basic Usage

Jason Penilla edited this page Mar 22, 2024 · 12 revisions

Setup

Run Paper

latest release

Basic Usage

In build.gradle.kts:

plugins {
  // Apply the plugin
  id("xyz.jpenilla.run-paper") version "2.2.0"
}

tasks {
  runServer {
    // Configure the Minecraft version for our task.
    // This is the only required configuration besides applying the plugin.
    // Your plugin's jar (or shadowJar if present) will be used automatically.
    minecraftVersion("1.19.2")
  }
}

You can now run a Paper server simply by invoking the runServer task!

Run Velocity

latest release

Basic Usage

In build.gradle.kts:

plugins {
  // Apply the plugin
  id("xyz.jpenilla.run-velocity") version "2.2.0"
}

tasks {
  runVelocity {
    // Configure the Velocity version for our task.
    // This is the only required configuration besides applying the plugin.
    // Your plugin's jar (or shadowJar if present) will be used automatically.
    velocityVersion("3.1.2-SNAPSHOT")
  }
}

You can now run a Velocity proxy simply by invoking the runVelocity task!

Run Waterfall

latest release

Basic Usage

In build.gradle.kts:

plugins {
  // Apply the plugin
  id("xyz.jpenilla.run-waterfall") version "2.2.0"
}

tasks {
  runWaterfall {
    // Configure the Waterfall version for our task.
    // This is the only required configuration besides applying the plugin.
    // Your plugin's jar (or shadowJar if present) will be used automatically.
    waterfallVersion("1.19")
  }
}

You can now run a Waterfall proxy simply by invoking the runWaterfall task!

System properties

The xyz.jpenilla.run-task system property will be set to true for runs.

Downloading plugins

run-task has the ability to automatically download plugins (for use in run tasks) from a variety of sources including GitHub Releases, Modrinth, Hangar, and plain URLs.

Adding plugin downloads directly to a task

In this example, we will use run-paper and its runServer task, but the same applies to the other plugins and their run tasks.

tasks {
  runServer {
    downloadPlugins {
      // make sure to double check the version id on the Modrinth version page
      modrinth("carbon", "2.1.0-beta.21")

      github("jpenilla", "MiniMOTD", "v2.0.13", "minimotd-bukkit-2.0.13.jar")

      hangar("squaremap", "1.2.0")

      url("https://download.luckperms.net/1515/bukkit/loader/LuckPerms-Bukkit-5.4.102.jar")    
    }
  }
}

Creating and merging download specs

In more complex setups, you may want to have multiple run tasks that share some or all of their plugin downloads. This is possible using RunExtension#downloadPluginsSpec and DownloadPluginsSpec#from.

In this example, we will use run-paper and its runServer task/runPaper extension, but the same applies to the other plugins and their run tasks/extensions.

// create a spec
val myPlugins = runPaper.downloadPluginsSpec {
  // add some plugins
  hangar("squaremap", "1.2.0")
  // ...
}

// create another spec
val allPlugins = runPaper.downloadPluginsSpec {
  from(myPlugins) // copy in everything from myPlugins
  // add some other plugins ...
}

tasks.runServer {
  downloadPlugins.from(allPlugins) // copy allPlugins into runServer.downloadPlugins
}

Folia

Folia support is provided in run-paper through the runPaper.folia extension. The simplest way to add a runFolia task is to call runPaper.folia.registerTask() in the build script.