Add runserver task
This commit is contained in:
parent
425c06af33
commit
d644dbef6e
|
|
@ -1,12 +1,17 @@
|
|||
import java.io.FileOutputStream
|
||||
import java.net.URL
|
||||
|
||||
plugins {
|
||||
`maven-publish`
|
||||
id("com.github.johnrengelman.shadow")
|
||||
id("xyz.jpenilla.run-paper") version "1.0.6"
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(project(":api")) // API
|
||||
compileOnly("com.alttd:Galaxy-API:1.19.2-R0.1-SNAPSHOT") // Galaxy
|
||||
compileOnly("com.gitlab.ruany:LiteBansAPI:0.3.5") // move to proxy
|
||||
compileOnly("org.apache.commons:commons-lang3:3.12.0") // needs an alternative, already removed from upstream api and will be removed in server
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
|
@ -21,4 +26,31 @@ tasks {
|
|||
dependsOn(shadowJar)
|
||||
}
|
||||
|
||||
runServer {
|
||||
val dir = File(System.getProperty("user.home") + "/share/devserver/");
|
||||
if (!dir.parentFile.exists()) {
|
||||
dir.parentFile.mkdirs()
|
||||
}
|
||||
runDirectory.set(dir)
|
||||
|
||||
val fileName = "/galaxy.jar"
|
||||
var file = File(dir.path + fileName)
|
||||
|
||||
if (!file.parentFile.exists()) {
|
||||
file.parentFile.mkdirs()
|
||||
}
|
||||
if (!file.exists()) {
|
||||
download("https://repo.destro.xyz/snapshots/com/alttd/Galaxy-Server/Galaxy-paperclip-1.19.2-R0.1-SNAPSHOT-reobf.jar", file)
|
||||
}
|
||||
serverJar(file)
|
||||
minecraftVersion("1.19.2")
|
||||
}
|
||||
}
|
||||
|
||||
fun download(link: String, path: File) {
|
||||
URL(link).openStream().use { input ->
|
||||
FileOutputStream(path).use { output ->
|
||||
input.copyTo(output)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user