2023-12-06 20:54:54 +01:00
|
|
|
import io.papermc.hangarpublishplugin.model.Platforms
|
|
|
|
|
2023-11-27 07:17:59 +01:00
|
|
|
plugins {
|
|
|
|
alias(libs.plugins.paperweight)
|
|
|
|
alias(libs.plugins.shadowjar)
|
|
|
|
|
2023-12-06 20:54:54 +01:00
|
|
|
alias(libs.plugins.modrinth)
|
|
|
|
|
2023-11-27 07:17:59 +01:00
|
|
|
alias(libs.plugins.runpaper)
|
|
|
|
|
2023-12-06 20:54:54 +01:00
|
|
|
alias(libs.plugins.hangar)
|
|
|
|
}
|
2023-11-27 07:17:59 +01:00
|
|
|
|
|
|
|
base {
|
2023-12-06 20:54:54 +01:00
|
|
|
archivesName = "${rootProject.name}"
|
2023-11-27 07:17:59 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
implementation(libs.metrics)
|
|
|
|
|
|
|
|
compileOnly(libs.vault)
|
|
|
|
|
|
|
|
paperweightDevelopmentBundle("io.papermc.paper:dev-bundle:$minecraftVersion-R0.1-SNAPSHOT")
|
|
|
|
}
|
|
|
|
|
2023-12-06 20:54:54 +01:00
|
|
|
String type = isBeta ? "Beta" : "Release"
|
|
|
|
|
|
|
|
String description = """
|
|
|
|
## Fixes:
|
|
|
|
* Glow now works again.
|
|
|
|
|
|
|
|
## 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
|
|
|
|
|
2023-11-27 07:17:59 +01:00
|
|
|
tasks {
|
|
|
|
runServer {
|
2023-12-06 20:54:54 +01:00
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
|
2023-11-27 07:17:59 +01:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|