Mixed project sample and more bug fixes.

This commit is contained in:
Alex Endfinger
2022-07-10 19:03:59 -04:00
parent adcff8dcc5
commit 39a7b50a07
29 changed files with 421 additions and 8 deletions

View File

@ -6,4 +6,5 @@ interface ConcreteExtension {
val paperVersionGroup: Property<String>
val paperApiVersion: Property<String>
val minecraftServerPath: Property<String>
val acceptServerEula: Property<Boolean>
}

View File

@ -7,6 +7,7 @@ import org.gradle.api.tasks.options.Option
import org.gradle.kotlin.dsl.getByType
import java.io.File
import java.nio.file.Files
import java.util.Properties
open class SetupPaperServer : DefaultTask() {
init {
@ -39,17 +40,21 @@ open class SetupPaperServer : DefaultTask() {
paperPluginsDirectory.mkdirs()
}
for (project in project.allprojects) {
if (!project.isPluginProject()) {
continue
}
for (project in project.findPluginProjects()) {
val task = project.shadowJarTask!!
val pluginJarFile = task.outputs.files.first()
val pluginLinkFile = paperPluginsDirectory.resolve("${project.name}.jar")
pluginLinkFile.delete()
Files.createSymbolicLink(pluginLinkFile.toPath(), pluginJarFile.toPath())
}
if (concrete.acceptServerEula.isPresent && concrete.acceptServerEula.get()) {
val writer = minecraftServerDirectory.resolve("eula.txt").bufferedWriter()
val properties = Properties()
properties.setProperty("eula", "true")
properties.store(writer, "Written by Concrete")
writer.close()
}
}
private fun downloadLatestBuild(paperVersionGroup: String, paperJarFile: File) {

View File

@ -14,9 +14,9 @@ class SmartDownloader(
val hashResult = checkLocalFileHash()
if (hashResult != HashResult.ValidHash) {
downloadRemoteFile()
return false
return true
}
return true
return false
}
private fun downloadRemoteFile() {