|
1 | 1 | import xyz.jpenilla.resourcefactory.bukkit.BukkitPluginYaml |
| 2 | +import xyz.jpenilla.runpaper.task.RunServer |
2 | 3 |
|
3 | 4 | plugins { |
4 | | - `java-library` |
5 | | - id("io.papermc.paperweight.userdev") version "2.0.0-beta.18" |
6 | | - id("xyz.jpenilla.run-paper") version "3.0.0-beta.1" // Adds runServer and runMojangMappedServer tasks for testing |
| 5 | + `my-conventions` |
| 6 | + id("io.papermc.paperweight.userdev") version "2.0.0-beta.18" apply false |
| 7 | + id("xyz.jpenilla.run-paper") version "3.0.0-beta.1" // Adds runServer task for testing |
7 | 8 | id("xyz.jpenilla.resource-factory-bukkit-convention") version "1.3.0" // Generates plugin.yml based on the Gradle config |
| 9 | + id("com.gradleup.shadow") version "8.3.8" |
8 | 10 | } |
9 | 11 |
|
10 | | -group = "io.papermc.paperweight" |
11 | | -version = "1.0.0-SNAPSHOT" |
12 | | -description = "Test plugin for paperweight-userdev" |
| 12 | +java.disableAutoTargetJvm() // Allow consuming JVM 21 projects (i.e. paper_1_21_8) even though our release is 17 |
13 | 13 |
|
14 | | -java { |
15 | | - // Configure the java toolchain. This allows gradle to auto-provision JDK 21 on systems that only have JDK 11 installed for example. |
16 | | - toolchain.languageVersion = JavaLanguageVersion.of(21) |
17 | | -} |
| 14 | +dependencies { |
| 15 | + compileOnly("io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT") |
| 16 | + |
| 17 | + implementation(project(":paper_hooks")) |
18 | 18 |
|
19 | | -// For 1.20.4 or below, or when you care about supporting Spigot on >=1.20.5: |
20 | | -/* |
21 | | -paperweight.reobfArtifactConfiguration = io.papermc.paperweight.userdev.ReobfArtifactConfiguration.REOBF_PRODUCTION |
| 19 | + // Shade the reobf variant |
| 20 | + runtimeOnly(project(":paper_1_17_1", configuration = "reobf")) |
| 21 | + runtimeOnly(project(":paper_1_19_4", configuration = "reobf")) |
| 22 | + |
| 23 | + // For Paper 1.20.5+, we don't need to use the reobf variant. |
| 24 | + // If you still support spigot, you will need to use the reobf variant, |
| 25 | + // and remove the Mojang-mapped metadata from the manifest below. |
| 26 | + runtimeOnly(project(":paper_1_21_8")) |
| 27 | +} |
22 | 28 |
|
23 | 29 | tasks.assemble { |
24 | | - dependsOn(tasks.reobfJar) |
| 30 | + dependsOn(tasks.shadowJar) |
25 | 31 | } |
26 | | - */ |
27 | 32 |
|
28 | | -dependencies { |
29 | | - paperweight.paperDevBundle("1.21.8-R0.1-SNAPSHOT") |
30 | | - // paperweight.foliaDevBundle("1.21.8-R0.1-SNAPSHOT") |
31 | | - // paperweight.devBundle("com.example.paperfork", "1.21.8-R0.1-SNAPSHOT") |
32 | | -} |
33 | | - |
34 | | -tasks { |
35 | | - compileJava { |
36 | | - // Set the release flag. This configures what version bytecode the compiler will emit, as well as what JDK APIs are usable. |
37 | | - // See https://openjdk.java.net/jeps/247 for more information. |
38 | | - options.release = 21 |
39 | | - } |
40 | | - javadoc { |
41 | | - options.encoding = Charsets.UTF_8.name() // We want UTF-8 for everything |
42 | | - } |
43 | | - |
44 | | - // Only relevant for 1.20.4 or below, or when you care about supporting Spigot on >=1.20.5: |
45 | | - /* |
46 | | - reobfJar { |
47 | | - // This is an example of how you might change the output location for reobfJar. It's recommended not to do this |
48 | | - // for a variety of reasons, however it's asked frequently enough that an example of how to do it is included here. |
49 | | - outputJar = layout.buildDirectory.file("libs/PaperweightTestPlugin-${project.version}.jar") |
50 | | - } |
51 | | - */ |
| 33 | +tasks.jar { |
| 34 | + manifest.attributes( |
| 35 | + "paperweight-mappings-namespace" to "mojang", |
| 36 | + ) |
52 | 37 | } |
53 | 38 |
|
54 | 39 | // Configure plugin.yml generation |
55 | 40 | // - name, version, and description are inherited from the Gradle project. |
56 | 41 | bukkitPluginYaml { |
57 | | - main = "io.papermc.paperweight.testplugin.TestPlugin" |
| 42 | + main = "my.plugin.MyPlugin" |
58 | 43 | load = BukkitPluginYaml.PluginLoadOrder.STARTUP |
59 | 44 | authors.add("Author") |
60 | | - apiVersion = "1.21.8" |
| 45 | + apiVersion = "1.17" |
| 46 | +} |
| 47 | + |
| 48 | +tasks.runServer { |
| 49 | + minecraftVersion("1.21.8") |
| 50 | +} |
| 51 | + |
| 52 | +tasks.register("run1_17_1", RunServer::class) { |
| 53 | + minecraftVersion("1.17.1") |
| 54 | + pluginJars.from(tasks.shadowJar.flatMap { it.archiveFile }) |
| 55 | + runDirectory = layout.projectDirectory.dir("run1_17_1") |
| 56 | + systemProperties["Paper.IgnoreJavaVersion"] = true |
| 57 | +} |
| 58 | + |
| 59 | +tasks.register("run1_19_4", RunServer::class) { |
| 60 | + minecraftVersion("1.19.4") |
| 61 | + pluginJars.from(tasks.shadowJar.flatMap { it.archiveFile }) |
| 62 | + runDirectory = layout.projectDirectory.dir("run1_19_4") |
| 63 | + systemProperties["Paper.IgnoreJavaVersion"] = true |
61 | 64 | } |
0 commit comments