add runServer task
This commit is contained in:
parent
a167392371
commit
d72709ec50
|
|
@ -1,4 +1,6 @@
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.FileOutputStream
|
||||||
|
import java.net.URL
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
|
|
@ -26,6 +28,26 @@ tasks {
|
||||||
dependsOn(shadowJar)
|
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"
|
||||||
|
val 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")
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bukkit {
|
bukkit {
|
||||||
|
|
@ -45,3 +67,11 @@ fun gitCommit(): String {
|
||||||
}
|
}
|
||||||
return String(os.toByteArray()).trim()
|
return String(os.toByteArray()).trim()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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