diff --git a/patches/server/Build-system-changes.patch b/patches/server/Build-system-changes.patch index aaa4e66bd4..8c9ccf659b 100644 --- a/patches/server/Build-system-changes.patch +++ b/patches/server/Build-system-changes.patch @@ -35,6 +35,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 "Specification-Vendor" to "Bukkit Team", + "Git-Branch" to gitBranch, // Paper + "Git-Commit" to gitHash, // Paper ++ "CraftBukkit-Package-Version" to craftbukkitPackageVersion, // Paper ) for (tld in setOf("net", "com", "org")) { attributes("$tld/bukkit", "Sealed" to true) diff --git a/patches/server/Hook-into-CB-plugin-rewrites.patch b/patches/server/Hook-into-CB-plugin-rewrites.patch index f27a178b43..78b4e47e5f 100644 --- a/patches/server/Hook-into-CB-plugin-rewrites.patch +++ b/patches/server/Hook-into-CB-plugin-rewrites.patch @@ -43,18 +43,18 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + // Paper start - Plugin rewrites + private static final Map SEARCH_AND_REMOVE = initReplacementsMap(); ++ private static final java.util.jar.Manifest manifest = io.papermc.paper.util.JarManifests.manifest(Commodore.class); + private static Map initReplacementsMap() + { + Map getAndRemove = new HashMap<>(); + // Be wary of maven shade's relocations + getAndRemove.put( "org/bukkit/".concat( "craftbukkit/libs/it/unimi/dsi/fastutil/" ), "org/bukkit/".concat( "craftbukkit/libs/" ) ); // Remap fastutil to our location + -+ if ( Boolean.getBoolean( "debug.rewriteForIde" ) ) ++ if ( Boolean.getBoolean( "debug.rewriteForIde" ) && manifest != null) + { + // unversion incoming calls for pre-relocate debug work -+ final String NMS_REVISION_PACKAGE = "v1_16_R3/"; ++ final String NMS_REVISION_PACKAGE = "v" + manifest.getMainAttributes().getValue("CraftBukkit-Package-Version") + "/"; + -+ getAndRemove.put( "net/minecraft/".concat( "server/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE ); + getAndRemove.put( "org/bukkit/".concat( "craftbukkit/" + NMS_REVISION_PACKAGE ), NMS_REVISION_PACKAGE ); + } + diff --git a/patches/server/Setup-Gradle-project.patch b/patches/server/Setup-Gradle-project.patch index e2eb559e0e..75c0d0fa21 100644 --- a/patches/server/Setup-Gradle-project.patch +++ b/patches/server/Setup-Gradle-project.patch @@ -58,6 +58,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + testImplementation("org.hamcrest:hamcrest-library:1.3") +} + ++val craftbukkitPackageVersion = "1_18_R2" // Paper +tasks.jar { + archiveClassifier.set("dev") + @@ -89,8 +90,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + +relocation { + // Order matters here - e.g. craftbukkit proper must be relocated before any of the libs are relocated into the cb package -+ val packageVersion = "1_18_R2" -+ relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$packageVersion") { ++ relocate("org.bukkit.craftbukkit" to "org.bukkit.craftbukkit.v$craftbukkitPackageVersion") { + exclude("org.bukkit.craftbukkit.Main*") + } +}