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
+8
View File
@@ -67,3 +67,11 @@ dependencies {
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() {
this.dependsOn.forEach {
Project resolved;
if (it instanceof Project) {
resolved = (Project) it;
} else if (it instanceof String) {
Project resolved
AbstractArchiveTask archiveTask
if (it instanceof String) {
resolved = project.findProject(it.substring(0, it.lastIndexOf(':')))
archiveTask = (AbstractArchiveTask) resolved.tasks.findByName(it.substring(it.lastIndexOf(':') + 1))
} else {
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}")
new ProcessBuilder("scp", archive.absolutePath, "sw:~/plugins/$template/${archive.name.replace("-all", "")}").start().waitFor()
println("Uploaded $archive to ~/plugins/${template}")
@@ -88,15 +88,21 @@ class DevServer extends DefaultTask {
}
void startDevServer() {
def devPy = new StringBuilder().append("dev.py")
if (port != null) devPy.append(" --port $port")
if (worldName != null) devPy.append(" -w $worldName")
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 devPy = new StringBuilder()
if (template.endsWith("Velocity")) {
devPy.append("cd DevVelocity")
devPy.append("; java -jar Velocity.jar --port 25566")
} else {
devPy.append("dev.py")
if (port != null) devPy.append(" --port $port")
if (worldName != null) devPy.append(" -w $worldName")
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 running = true;