From f2e08b6234a5c08534d83e23e91b6f693c296fec Mon Sep 17 00:00:00 2001 From: Len <40720638+destro174@users.noreply.github.com> Date: Fri, 21 Jul 2023 22:16:36 +0200 Subject: [PATCH] Change some gradle stuff --- build.gradle.kts | 39 ++++++++++++++++++++++++++++++++++++++- settings.gradle.kts | 1 + 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5da7783..0d62744 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,13 +1,18 @@ +import java.io.ByteArrayOutputStream +import java.io.FileOutputStream +import java.net.URL + plugins { `java-library` `maven-publish` + id("xyz.jpenilla.run-paper") version "1.0.6" } dependencies { compileOnly("com.alttd:Galaxy-API:1.20.1-R0.1-SNAPSHOT") { isChanging = true } - compileOnly("com.alttd:AltitudeAPI:LATEST") + compileOnly("com.alttd:AltitudeAPI:0.0.2") compileOnly("me.filoghost.holographicdisplays:holographicdisplays-api:3.0.0") compileOnly("org.jetbrains:annotations:16.0.2") testImplementation("org.powermock:powermock-module-junit4:1.7.4") @@ -51,4 +56,36 @@ tasks { withType { options.encoding = Charsets.UTF_8.name() } + + jar { + archiveFileName.set("${rootProject.name}.jar") + } + + 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/private/com/alttd/Galaxy-Server/Galaxy-paperclip-1.19.4-R0.1-SNAPSHOT-reobf.jar", file) + } + serverJar(file) + minecraftVersion("1.20.1") + } +} + +fun download(link: String, path: File) { + URL(link).openStream().use { input -> + FileOutputStream(path).use { output -> + input.copyTo(output) + } + } } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 33faf04..8941a69 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,6 +2,7 @@ rootProject.name = "AltitudeTag" dependencyResolutionManagement { repositories { + mavenLocal() mavenCentral() maven("https://repo.destro.xyz/snapshots") // Altitude - Galaxy maven("https://repo.codemc.io/repository/maven-public/")