Files
PlayerBlockLife/build.gradle
xiaobai ad5cdf1c64 2.2.0-1.20.4
将生命方块由玩家头换为其他原版多颜色方块
2026-02-16 17:44:38 +08:00

83 lines
1.9 KiB
Groovy
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
plugins {
id 'java'
id 'com.github.johnrengelman.shadow' version '8.1.1'
}
group = 'com.playerblocklife'
version = '2.2.0-1.20.4'
sourceCompatibility = 17
targetCompatibility = 17
repositories {
mavenCentral()
maven {
url = 'https://repo.papermc.io/repository/maven-public/'
}
maven {
url = 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/'
}
}
dependencies {
compileOnly 'io.papermc.paper:paper-api:1.20.4-R0.1-SNAPSHOT'
// 或者使用Spigot API
// compileOnly 'org.spigotmc:spigot-api:1.20.4-R0.1-SNAPSHOT'
// 依赖库
implementation 'com.google.code.gson:gson:2.10.1'
implementation 'org.yaml:snakeyaml:2.2'
}
shadowJar {
archiveClassifier.set('')
minimize()
// 排除签名文件
exclude 'META-INF/*.SF'
exclude 'META-INF/*.DSA'
exclude 'META-INF/*.RSA'
// 如果需要重定位依赖包名,可以在这里添加
// relocate 'com.google.gson', 'com.playerblocklife.libs.gson'
// relocate 'org.yaml', 'com.playerblocklife.libs.yaml'
}
// 确保构建时包含shadowJar
tasks.build.dependsOn tasks.shadowJar
// 配置编译选项
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
options.compilerArgs += ['-parameters']
}
// 配置测试
test {
useJUnitPlatform()
}
// 配置JAR任务
jar {
manifest {
attributes(
'Implementation-Version': project.version,
'Main-Class': 'com.playerblocklife.PlayerBlockLife'
)
}
}
// 添加自定义任务
task buildPlugin {
dependsOn shadowJar
group = 'build'
description = '构建插件JAR文件'
doLast {
println "=" * 50
println "插件构建完成!"
println "文件位置: ${shadowJar.archiveFile.get().asFile.absolutePath}"
println "文件大小: ${shadowJar.archiveFile.get().asFile.length() / 1024} KB"
println "=" * 50
}
}