Fix run bungeecord not build jar

This commit is contained in:
2025-05-03 14:53:00 +08:00
parent 7024f2c2ac
commit 3455d8b302
2 changed files with 10 additions and 1 deletions

View File

@@ -1,2 +1,2 @@
kotlin.code.style=official kotlin.code.style=official
pluginVersion=0.1.4 pluginVersion=0.1.5

View File

@@ -22,6 +22,10 @@ abstract class RunBrokerBungeeCordTask : DefaultTask() {
private val logger = LoggerFactory.getLogger("RunBrokerBungeeCord") private val logger = LoggerFactory.getLogger("RunBrokerBungeeCord")
init {
dependsOn(project.tasks.named("shadowJar"))
}
@TaskAction @TaskAction
fun runSubserver() { fun runSubserver() {
val settings = project.extensions.getByType(RunBrokerSubserverExtension::class.java) val settings = project.extensions.getByType(RunBrokerSubserverExtension::class.java)
@@ -39,6 +43,11 @@ abstract class RunBrokerBungeeCordTask : DefaultTask() {
logger.info("BungeeCord downloaded...") logger.info("BungeeCord downloaded...")
if (!bungeeCord.exists()) bungeeCord.writeBytes(bungeeCordBytes) if (!bungeeCord.exists()) bungeeCord.writeBytes(bungeeCordBytes)
val executablePath = settings.javaExecPath.get().path val executablePath = settings.javaExecPath.get().path
val previousPluginJar = File(pluginsDir, "_broker-plugin.jar")
if (previousPluginJar.exists()) previousPluginJar.delete()
val shadowJarTask = project.tasks.named("shadowJar").get()
val builtJar = shadowJarTask.outputs.files.singleFile
builtJar.copyTo(previousPluginJar, overwrite = true)
project.exec { project.exec {
it.executable = if (executablePath == "-") "java" else executablePath it.executable = if (executablePath == "-") "java" else executablePath
it.workingDir = project.layout.projectDirectory.dir("run/bungee/").asFile it.workingDir = project.layout.projectDirectory.dir("run/bungee/").asFile