diff --git a/gradle.properties b/gradle.properties index e533000..2e1b9f3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,2 +1,2 @@ kotlin.code.style=official -pluginVersion=0.1.4 \ No newline at end of file +pluginVersion=0.1.5 \ No newline at end of file diff --git a/runbroker-subserver-plugin/src/main/kotlin/cn/rtast/runbroker/subserver/bungeecord/RunBrokerBungeeCordTask.kt b/runbroker-subserver-plugin/src/main/kotlin/cn/rtast/runbroker/subserver/bungeecord/RunBrokerBungeeCordTask.kt index 05e6651..c5c91af 100644 --- a/runbroker-subserver-plugin/src/main/kotlin/cn/rtast/runbroker/subserver/bungeecord/RunBrokerBungeeCordTask.kt +++ b/runbroker-subserver-plugin/src/main/kotlin/cn/rtast/runbroker/subserver/bungeecord/RunBrokerBungeeCordTask.kt @@ -22,6 +22,10 @@ abstract class RunBrokerBungeeCordTask : DefaultTask() { private val logger = LoggerFactory.getLogger("RunBrokerBungeeCord") + init { + dependsOn(project.tasks.named("shadowJar")) + } + @TaskAction fun runSubserver() { val settings = project.extensions.getByType(RunBrokerSubserverExtension::class.java) @@ -39,6 +43,11 @@ abstract class RunBrokerBungeeCordTask : DefaultTask() { logger.info("BungeeCord downloaded...") if (!bungeeCord.exists()) bungeeCord.writeBytes(bungeeCordBytes) 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 { it.executable = if (executablePath == "-") "java" else executablePath it.workingDir = project.layout.projectDirectory.dir("run/bungee/").asFile