Skip to content

Commit

Permalink
Add gradle tasks to run various server versions
Browse files Browse the repository at this point in the history
  • Loading branch information
oh-noey committed Aug 11, 2024
1 parent 9ccfe24 commit 9996383
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion Movecraft/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import xyz.jpenilla.runpaper.task.RunServer

plugins {
`maven-publish`
id("buildlogic.java-conventions")
id("io.github.goooler.shadow") version "8.1.7"
id("io.papermc.hangar-publish-plugin") version "0.1.2"
id("xyz.jpenilla.run-paper") version "2.3.0"
}

java.toolchain.languageVersion = JavaLanguageVersion.of(17)

val supportedMinecraftVersions = listOf(
"1.18.2",
"1.20.6",
"1.21"
)

dependencies {
runtimeOnly(project(":movecraft-v1_18", "reobf"))
runtimeOnly(project(":movecraft-v1_20", "reobf"))
Expand Down Expand Up @@ -36,6 +45,23 @@ tasks.processResources {
expand(mapOf("projectVersion" to project.version))
}
}
tasks {
supportedMinecraftVersions.forEach { serverVersion ->
register<RunServer>("run-$serverVersion") {
minecraftVersion(serverVersion)
jvmArgs("-DPaper.IgnoreJavaVersion=true", "-Dcom.mojang.eula.agree=true")
group = "run paper"
runDirectory.set(file("run-$serverVersion"))
downloadPlugins {
url("https://dev.bukkit.org/projects/worldedit/files/5564367/download")
url("https://ci.lucko.me/job/spark/441/artifact/spark-bukkit/build/libs/spark-1.10.95-bukkit.jar")
hangar("ViaVersion", "5.0.3")
hangar("ViaBackwards", "5.0.3")
}
pluginJars(project.tasks.shadowJar.map { it.archiveFile }.get())
}
}
}

publishing {
publications {
Expand Down Expand Up @@ -68,7 +94,7 @@ hangarPublish {
platforms {
register(io.papermc.hangarpublishplugin.model.Platforms.PAPER) {
jar.set(tasks.shadowJar.flatMap { it.archiveFile })
platformVersions.set(listOf("1.18.2", "1.20.6", "1.21"))
platformVersions.set(supportedMinecraftVersions)
}
}
}
Expand Down

0 comments on commit 9996383

Please sign in to comment.