Enable Velocity, prio Setup needed for that

This commit is contained in:
2025-04-17 10:40:50 +02:00
parent e393aad25f
commit 32703c6659
2 changed files with 29 additions and 15 deletions
+9 -1
View File
@@ -66,4 +66,12 @@ dependencies {
implementation(libs.apolloprotos) implementation(libs.apolloprotos)
implementation(libs.nbt) implementation(libs.nbt)
} }
tasks.register<DevServer>("DevVelocity") {
group = "run"
description = "Run a Dev Velocity"
dependsOn(":VelocityCore:shadowJar")
dependsOn(":VelocityCore:Persistent:jar")
template = "Velocity"
}
+20 -14
View File
@@ -71,16 +71,16 @@ class DevServer extends DefaultTask {
void uploadDependencies() { void uploadDependencies() {
this.dependsOn.forEach { this.dependsOn.forEach {
Project resolved; Project resolved
if (it instanceof Project) { AbstractArchiveTask archiveTask
resolved = (Project) it; if (it instanceof String) {
} else if (it instanceof String) {
resolved = project.findProject(it.substring(0, it.lastIndexOf(':'))) resolved = project.findProject(it.substring(0, it.lastIndexOf(':')))
archiveTask = (AbstractArchiveTask) resolved.tasks.findByName(it.substring(it.lastIndexOf(':') + 1))
} else { } else {
throw new GradleException("Illegal argument for uploading dependencies") throw new GradleException("Illegal argument for uploading dependencies")
} }
def archive = ((AbstractArchiveTask) resolved.tasks.findByName("shadowJar")).archiveFile.get().asFile def archive = archiveTask.archiveFile.get().asFile
println("Uploading $archive to ~/plugins/${template}") println("Uploading $archive to ~/plugins/${template}")
new ProcessBuilder("scp", archive.absolutePath, "sw:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor() new ProcessBuilder("scp", archive.absolutePath, "sw:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor()
println("Uploaded $archive to ~/plugins/${template}") println("Uploaded $archive to ~/plugins/${template}")
@@ -88,15 +88,21 @@ class DevServer extends DefaultTask {
} }
void startDevServer() { void startDevServer() {
def devPy = new StringBuilder().append("dev.py") def devPy = new StringBuilder()
if (port != null) devPy.append(" --port $port") if (template.endsWith("Velocity")) {
if (worldName != null) devPy.append(" -w $worldName") devPy.append("cd DevVelocity")
devPy.append(" -p plugins/$template") devPy.append("; java -jar Velocity.jar --port 25566")
if (profile) devPy.append(" --profile") } else {
if (forceUpgrade) devPy.append(" --forceUpgrade") devPy.append("dev.py")
if (jar != null) devPy.append(" --jar $jar") if (port != null) devPy.append(" --port $port")
println("Starting $template with command ${devPy.toString()}") if (worldName != null) devPy.append(" -w $worldName")
devPy.append(" $template") devPy.append(" -p plugins/$template")
if (profile) devPy.append(" --profile")
if (forceUpgrade) devPy.append(" --forceUpgrade")
if (jar != null) devPy.append(" --jar $jar")
println("Starting $template with command ${devPy.toString()}")
devPy.append(" $template")
}
def process = new ProcessBuilder("ssh", "sw", "-T", devPy.toString()).start(); def process = new ProcessBuilder("ssh", "sw", "-T", devPy.toString()).start();
def running = true; def running = true;