CrazyAuctions/paper/build.gradle

127 lines
2.9 KiB
Groovy

import io.papermc.hangarpublishplugin.model.Platforms
plugins {
alias(libs.plugins.paperweight)
alias(libs.plugins.shadowjar)
alias(libs.plugins.modrinth)
alias(libs.plugins.runpaper)
alias(libs.plugins.hangar)
}
base {
archivesName = "${rootProject.name}"
}
dependencies {
implementation(libs.metrics)
compileOnly(libs.vault)
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:$minecraftVersion-R0.1-SNAPSHOT")
}
String type = isBeta ? "Beta" : "Release"
String description = """
## Fixes:
* Fix not being able to buy items
* Fix an issue where it would scream about tasks needing to be run sync
## Other:
* [Feature Requests](https://github.com/Crazy-Crew/${rootProject.name}/issues)
* [Bug Reports](https://github.com/Crazy-Crew/${rootProject.name}/issues)
"""
File file = project.layout.buildDirectory.file("libs/${rootProject.name}-${rootProject.version}.jar").get().asFile
tasks {
runServer {
// Publish to hangar.papermc.io.
hangarPublish {
publications.register("plugin") {
version.set("$rootProject.version")
id.set(rootProject.name)
channel.set(type)
changelog.set(description)
apiKey.set(System.getenv("hangar_key"))
platforms {
register(Platforms.PAPER) {
jar.set(file)
platformVersions.set(["$minecraftVersion"])
}
}
}
}
// Publish to modrinth.
modrinth {
setAutoAddDependsOn(false)
token.set(System.getenv("modrinth_token"))
projectId.set(rootProject.name.toLowerCase())
versionName.set("${rootProject.name} ${rootProject.version}")
versionNumber.set("${rootProject.version}")
versionType.set(type.toLowerCase())
uploadFile.set(file)
gameVersions.add(minecraftVersion)
changelog.set(description)
loaders.addAll("paper", "purpur")
}
jvmArgs("-Dnet.kyori.ansi.colorLevel=truecolor")
minecraftVersion(minecraftVersion)
}
assemble {
dependsOn(reobfJar)
}
shadowJar {
mergeServiceFiles()
exclude("META-INF/**")
List.of(
"org.bstats"
).forEach {
relocate(it, "libs.$it")
}
}
processResources {
Map<String, String> props = new HashMap<>()
props.put("name", rootProject.name)
props.put("version", "$rootProject.version")
props.put("group", "$project.group")
props.put("description", rootProject.description)
props.put("apiVersion", apiVersion)
props.put("authors", authors)
props.put("website", website)
inputs.properties(props)
filesMatching("plugin.yml") {
expand(props)
}
}
}