Page MenuHomeDevCentral

D3650.diff
No OneTemporary

D3650.diff

diff --git a/plugins/suhayl/build.gradle.kts b/plugins/suhayl/build.gradle.kts
--- a/plugins/suhayl/build.gradle.kts
+++ b/plugins/suhayl/build.gradle.kts
@@ -119,6 +119,52 @@
commandLine("scp", zipFile.absolutePath, "$remoteUser@$remoteHost:$remoteDir")
}
+tasks.register("updateServerProperties") {
+ group = "deployment"
+ description = "Fetch server.properties, update resource-pack-sha1, and push back."
+
+ dependsOn(
+ "deployResourcePack",
+ "updateResourcePackProperties",
+ )
+
+ doLast {
+ val remoteHost = (findProperty("remoteHost") as String?) ?: "windriver.nasqueron.org"
+ val remoteUser = (findProperty("remoteUser") as String?) ?: System.getenv("USER") ?: "deploy"
+ val remotePath = (findProperty("remoteServerPropertiesPath") as String?) ?: "/usr/local/minecraft/server.properties"
+
+ val localFile = layout.buildDirectory.file("server.properties").get()
+ val localPath = localFile.asFile.absolutePath
+
+ // Read hash from properties generated during updateResourcePackProperties task
+ val properties = Properties().apply {
+ resourcePackProperties.asFile.inputStream().use { load(it) }
+ }
+ val sha1 = properties.getProperty("resourcepack.sha1")
+ ?: throw GradleException("Missing property 'resource-pack-sha1' in ${resourcePackProperties.asFile}")
+
+ exec {
+ commandLine("scp", "$remoteUser@$remoteHost:$remotePath", localPath)
+ }
+
+ val propertiesFile = localFile.asFile;
+ val lines = propertiesFile.readLines().toMutableList()
+ val idx = lines.indexOfFirst { it.startsWith("resource-pack-sha1=") }
+ if (idx >= 0) {
+ lines[idx] = "resource-pack-sha1=$sha1"
+ } else {
+ lines.add("resource-pack-sha1=$sha1")
+ }
+ propertiesFile.writeText(lines.joinToString("\n"))
+
+ exec {
+ commandLine("scp", localPath, "$remoteUser@$remoteHost:$remotePath")
+ }
+
+ println("✅ Updated server.properties with resource-pack-sha1=$sha1")
+ }
+}
+
tasks.register<Exec>("deploy") {
group = "deployment"
description = "SCP the built JAR to windriver.nasqueron.org (configurable via -PremoteUser and -PremoteDir)."
@@ -127,6 +173,7 @@
tasks.named("build"),
tasks.named("jar"),
tasks.named("deployResourcePack"),
+ tasks.named("updateServerProperties"),
)
val remoteHost = (findProperty("remoteHost") as String?) ?: "windriver.nasqueron.org"

File Metadata

Mime Type
text/plain
Expires
Thu, Sep 4, 15:36 (20 h, 6 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2955146
Default Alt Text
D3650.diff (2 KB)

Event Timeline