-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
100 lines (88 loc) · 3.67 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
100 lines (88 loc) · 3.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
plugins {
java
id("com.gradleup.shadow") version "9.5.1"
id("xyz.jpenilla.run-paper") version "3.0.2"
}
group = "com.example.continentregions"
version = "2.1.1"
java {
toolchain {
languageVersion.set(JavaLanguageVersion.of(21))
}
}
repositories {
mavenCentral()
maven("https://repo.papermc.io/repository/maven-public/") // Paper API
maven("https://maven.enginehub.org/repo/") { // WorldEdit / WorldGuard
// EngineHub ships Gradle module metadata with strict constraints
// (gson/guava/fastutil "provided by Mojang") that clash with paper-api's
// newer versions and break resolution. Read only the POM so those strict
// constraints are ignored; the server provides these libs at runtime anyway.
metadataSources {
mavenPom()
artifact()
ignoreGradleMetadataRedirection()
}
}
maven("https://repo.bluecolored.de/releases") // BlueMapAPI
}
dependencies {
// Provided by the server at runtime — never bundled into the jar.
compileOnly("io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT")
// Pinned to match the dev runtime (runServer): WorldEdit 7.3.11 / WorldGuard 7.0.13.
compileOnly("com.sk89q.worldedit:worldedit-bukkit:7.3.11")
compileOnly("com.sk89q.worldguard:worldguard-bukkit:7.0.13")
compileOnly("de.bluecolored:bluemap-api:2.7.8")
// Bundled (shaded) third-party runtime dependencies.
implementation("com.google.code.gson:gson:2.14.0")
// SQLite backend (v2). Deliberately NOT relocated: the xerial driver loads a
// native library from a package-derived resource path, which relocation would
// break. Bukkit's per-plugin classloader isolates it from other plugins.
implementation("org.xerial:sqlite-jdbc:3.53.2.0")
testImplementation("org.junit.jupiter:junit-jupiter:6.1.0")
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testImplementation("org.mockito:mockito-core:5.23.0")
}
tasks {
compileJava {
options.encoding = "UTF-8"
options.release.set(21)
options.compilerArgs.addAll(listOf("-Xlint:deprecation", "-Xlint:unchecked"))
}
processResources {
val props = mapOf("version" to project.version)
inputs.properties(props)
filteringCharset = "UTF-8"
filesMatching("plugin.yml") {
expand(props)
}
}
shadowJar {
archiveClassifier.set("")
// Relocate bundled libraries to avoid clashes with other plugins / the server.
// No minimize(): Gson resolves type adapters reflectively and minimize can strip them.
relocate("com.google.gson", "com.example.continentregions.lib.gson")
// Keep the SQLite JDBC driver's META-INF/services/java.sql.Driver intact.
mergeServiceFiles()
}
build {
dependsOn(shadowJar)
}
test {
useJUnitPlatform()
}
// Local dev server: downloads Paper + required plugins into run/plugins automatically.
runServer {
minecraftVersion("1.21.4")
downloadPlugins {
// WorldEdit: pinned to the 7.3.11 *bukkit* jar via direct URL. Two reasons:
// - 7.4.x are 2026 JDK-25 builds whose class files (major 69) Paper's
// plugin remapper (ASM 9.7.1) cannot read.
// - modrinth() grabs the version's primary file, which for WorldEdit is a
// non-bukkit loader jar (no plugin.yml); the URL points at the bukkit jar.
url("https://cdn.modrinth.com/data/1u6JkXh5/versions/DlD8WKr9/worldedit-bukkit-7.3.11.jar")
modrinth("worldguard", "7.0.13")
modrinth("bluemap", "5.16-spigot")
}
}
}