Skip to content

Commit

Permalink
Copy all jars to plugins folder
Browse files Browse the repository at this point in the history
  • Loading branch information
osipxd committed Sep 9, 2017
1 parent 81bdeb6 commit 34817e0
Showing 1 changed file with 15 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package ru.endlesscode.bukkitgradle.task
import org.gradle.api.DefaultTask
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
import org.gradle.jvm.tasks.Jar
import ru.endlesscode.bukkitgradle.extension.RunConfiguration
import ru.endlesscode.bukkitgradle.server.ServerCore

Expand All @@ -27,7 +28,7 @@ class PrepareServer extends DefaultTask {
void prepareServer() {
resolveEula()
resolveOnlineMode()
copyPluginToServerDir()
copyPluginsToServerDir()
}

void resolveEula() {
Expand All @@ -54,16 +55,24 @@ class PrepareServer extends DefaultTask {
properties.store(propsFile.newWriter(), "Minecraft server properties")
}

void copyPluginToServerDir() {
void copyPluginsToServerDir() {
String pluginName = "${project.bukkit.meta.name}.jar"
Path jar = project.jar.archivePath.toPath()
if (!Files.exists(jar)) {
return
List<Path> paths = project.tasks.withType(Jar).collect { jar ->
if (jar.classifier.matches("src|source[s]?|javadoc")) {
return
}
jar.archivePath.toPath()
}

Path pluginsDir = getServerDir().resolve("plugins")
Files.createDirectories(pluginsDir)
Files.copy(jar, pluginsDir.resolve(pluginName), StandardCopyOption.REPLACE_EXISTING)
paths.forEach { jar ->
if (!Files.exists(jar)) {
return
}

Files.copy(jar, pluginsDir.resolve(pluginName), StandardCopyOption.REPLACE_EXISTING)
}
}

Path getServerDir() {
Expand Down

0 comments on commit 34817e0

Please sign in to comment.