| 1 | plugins { |
| 2 | java |
| 3 | id("com.gradleup.shadow") version "9.3.1" |
| 4 | } |
| 5 | |
| 6 | group = "nl.timfalken" |
| 7 | version = "1.0.12" |
| 8 | |
| 9 | repositories { |
| 10 | mavenCentral() |
| 11 | maven("https://repo.papermc.io/repository/maven-public/") |
| 12 | maven("https://repo.codemc.io/repository/maven-releases/") |
| 13 | maven("https://repo.codemc.io/repository/maven-snapshots/") |
| 14 | } |
| 15 | |
| 16 | dependencies { |
| 17 | compileOnly("io.papermc.paper:paper-api:26.2.build.+") |
| 18 | |
| 19 | // Bundled into ChestPreview by shadowJar. Adventure stays on Paper's classpath; |
| 20 | // relocating net.kyori is what broke embedded PacketEvents on load. |
| 21 | implementation("com.github.retrooper:packetevents-spigot:2.13.0") { |
| 22 | exclude(group = "net.kyori") |
| 23 | } |
| 24 | testImplementation("io.papermc.paper:paper-api:26.2.build.+") |
| 25 | testImplementation("org.junit.jupiter:junit-jupiter:5.11.4") |
| 26 | testImplementation("org.yaml:snakeyaml:2.4") |
| 27 | testRuntimeOnly("org.junit.platform:junit-platform-launcher") |
| 28 | |
| 29 | } |
| 30 | |
| 31 | java { |
| 32 | toolchain.languageVersion.set(JavaLanguageVersion.of(25)) |
| 33 | } |
| 34 | |
| 35 | tasks.jar { |
| 36 | enabled = false |
| 37 | } |
| 38 | |
| 39 | tasks.shadowJar { |
| 40 | archiveClassifier.set("") |
| 41 | archiveFileName.set("ChestPreview-${project.version}.jar") |
| 42 | |
| 43 | // Same relocation as ContainerPipes: only PacketEvents itself. Paper already |
| 44 | // ships Adventure and Gson; relocating those breaks PacketEvents on load. |
| 45 | relocate("com.github.retrooper.packetevents", "nl.timfalken.chestpreview.libs.packetevents.api") |
| 46 | relocate("io.github.retrooper.packetevents", "nl.timfalken.chestpreview.libs.packetevents.impl") |
| 47 | |
| 48 | // PacketEvents embeds bStats in the Spigot implementation. Keep our private copy private too. |
| 49 | relocate("org.bstats", "nl.timfalken.chestpreview.libs.bstats") |
| 50 | |
| 51 | mergeServiceFiles() |
| 52 | |
| 53 | // Intentionally do NOT call minimize(): PacketEvents warns this can cause classloading issues. |
| 54 | } |
| 55 | |
| 56 | tasks.assemble { |
| 57 | dependsOn(tasks.shadowJar) |
| 58 | } |
| 59 | |
| 60 | tasks.build { |
| 61 | dependsOn(tasks.shadowJar) |
| 62 | } |
| 63 | |
| 64 | tasks.test { |
| 65 | useJUnitPlatform() |
| 66 | } |