|
| 1 | +plugins { |
| 2 | + java |
| 3 | +} |
| 4 | + |
| 5 | +group = "com.mrfloris" |
| 6 | +description = "1MB helper plugin that prevents end crystals from damaging blocks" |
| 7 | + |
| 8 | +val pluginVersion = providers.gradleProperty("pluginVersion").get() |
| 9 | +val buildNumber = providers.gradleProperty("buildNumber").get() |
| 10 | +val javaTarget = providers.gradleProperty("javaTarget").get() |
| 11 | +val targetPaperVersion = providers.gradleProperty("targetPaperVersion").get() |
| 12 | +val targetMinecraftVersion = providers.gradleProperty("targetMinecraftVersion").get() |
| 13 | + |
| 14 | +version = pluginVersion |
| 15 | + |
| 16 | +repositories { |
| 17 | + mavenCentral() |
| 18 | + maven("https://repo.papermc.io/repository/maven-public/") |
| 19 | +} |
| 20 | + |
| 21 | +val localPaperApi = layout.projectDirectory.file( |
| 22 | + "servers/Server-One-Paper-1.21.11/libraries/io/papermc/paper/paper-api/1.21.11-R0.1-SNAPSHOT/paper-api-1.21.11-R0.1-SNAPSHOT.jar" |
| 23 | +).asFile |
| 24 | +val localPaperLibraries = layout.projectDirectory.dir("servers/Server-One-Paper-1.21.11/libraries").asFile |
| 25 | + |
| 26 | +dependencies { |
| 27 | + if (localPaperApi.exists() && localPaperLibraries.isDirectory) { |
| 28 | + compileOnly(files(localPaperApi)) |
| 29 | + compileOnly(fileTree(localPaperLibraries) { |
| 30 | + include("**/*.jar") |
| 31 | + }) |
| 32 | + } else { |
| 33 | + compileOnly("io.papermc.paper:paper-api:1.21.11-R0.1-SNAPSHOT") |
| 34 | + } |
| 35 | +} |
| 36 | + |
| 37 | +java { |
| 38 | + toolchain { |
| 39 | + languageVersion.set(JavaLanguageVersion.of(javaTarget.toInt())) |
| 40 | + } |
| 41 | +} |
| 42 | + |
| 43 | +tasks.compileJava { |
| 44 | + options.encoding = "UTF-8" |
| 45 | + options.release.set(javaTarget.toInt()) |
| 46 | +} |
| 47 | + |
| 48 | +tasks.processResources { |
| 49 | + val properties = mapOf( |
| 50 | + "pluginName" to "1MB-EndCrystals", |
| 51 | + "pluginVersion" to pluginVersion, |
| 52 | + "pluginDescription" to project.description, |
| 53 | + "buildNumber" to buildNumber, |
| 54 | + "javaTarget" to javaTarget, |
| 55 | + "targetPaperVersion" to targetPaperVersion, |
| 56 | + "targetMinecraftVersion" to targetMinecraftVersion, |
| 57 | + "website" to "https://github.com/mrfdev/EndCrystals" |
| 58 | + ) |
| 59 | + |
| 60 | + inputs.properties(properties) |
| 61 | + filteringCharset = "UTF-8" |
| 62 | + |
| 63 | + filesMatching(listOf("plugin.yml", "build-info.properties")) { |
| 64 | + expand(properties) |
| 65 | + } |
| 66 | +} |
| 67 | + |
| 68 | +tasks.jar { |
| 69 | + archiveFileName.set("1MB-EndCrystals-v${pluginVersion}-${buildNumber}-v${javaTarget}-${targetPaperVersion}.jar") |
| 70 | + |
| 71 | + manifest { |
| 72 | + attributes( |
| 73 | + "Implementation-Title" to "1MB-EndCrystals", |
| 74 | + "Implementation-Version" to pluginVersion, |
| 75 | + "Build-Number" to buildNumber, |
| 76 | + "Target-Paper-Version" to targetPaperVersion, |
| 77 | + "Target-Minecraft-Version" to targetMinecraftVersion, |
| 78 | + "Build-Java-Version" to javaTarget |
| 79 | + ) |
| 80 | + } |
| 81 | +} |
0 commit comments