diff --git a/plugin/build.gradle.kts b/plugin/build.gradle.kts index 96b8350..c46a912 100644 --- a/plugin/build.gradle.kts +++ b/plugin/build.gradle.kts @@ -1,4 +1,6 @@ import java.io.ByteArrayOutputStream +import java.io.FileOutputStream +import java.net.URL plugins { `maven-publish` @@ -26,6 +28,26 @@ 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" + 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 { @@ -45,3 +67,11 @@ fun gitCommit(): String { } return String(os.toByteArray()).trim() } + +fun download(link: String, path: File) { + URL(link).openStream().use { input -> + FileOutputStream(path).use { output -> + input.copyTo(output) + } + } +} \ No newline at end of file