fix(carry): support Purpur 26.3
This commit is contained in:
1 parent
53f9c817cf
commit
ec8a6eb7df
4 files changed
+31
-13
No files matched your search
@@ -1,10 +1,10 @@
|
|||||||
# Purpur Carry
|
# Purpur Carry
|
||||||
|
|
||||||
Purpur Carry is a Purpur 26.2 plugin for native animal and Villager carrying on SoMC. The approved behavior is specified in the [SoMC OKF wiki](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/purpur-carry/index.md).
|
Purpur Carry is a Purpur 26.3 plugin for native animal and Villager carrying on SoMC. The approved behavior is specified in the [SoMC OKF wiki](https://git.garvis.dev/dmg/somc-okf/src/branch/main/projects/purpur-carry/index.md).
|
||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
- Purpur 26.2 build 2618
|
- Purpur 26.3 build 2651
|
||||||
- Java 25 or newer
|
- Java 25 or newer
|
||||||
- Node.js 20 or newer for release-tool verification
|
- Node.js 20 or newer for release-tool verification
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -26,9 +26,9 @@ tasks.withType<JavaCompile>().configureEach {
|
|||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.purpurmc.purpur:purpur-api:26.2.build.2618-stable")
|
compileOnly("org.purpurmc.purpur:purpur-api:26.3.build.2651-stable")
|
||||||
|
|
||||||
testImplementation("org.purpurmc.purpur:purpur-api:26.2.build.2618-stable")
|
testImplementation("org.purpurmc.purpur:purpur-api:26.3.build.2651-stable")
|
||||||
testImplementation(platform("org.junit:junit-bom:5.13.4"))
|
testImplementation(platform("org.junit:junit-bom:5.13.4"))
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||||
testImplementation("org.mockito:mockito-core:5.18.0")
|
testImplementation("org.mockito:mockito-core:5.18.0")
|
||||||
@@ -55,20 +55,20 @@ tasks.check { dependsOn(releaseToolCheck) }
|
|||||||
// Exercise actual Purpur event dispatch and command registration without starting a server.
|
// Exercise actual Purpur event dispatch and command registration without starting a server.
|
||||||
val carryRuntime = layout.buildDirectory.dir("carry-runtime")
|
val carryRuntime = layout.buildDirectory.dir("carry-runtime")
|
||||||
val downloadCarryRuntime = tasks.register("downloadCarryRuntime") {
|
val downloadCarryRuntime = tasks.register("downloadCarryRuntime") {
|
||||||
val launcher = carryRuntime.map { it.file("purpur-26.2-2618.jar") }
|
val launcher = carryRuntime.map { it.file("purpur-26.3-2651.jar") }
|
||||||
outputs.file(launcher)
|
outputs.file(launcher)
|
||||||
doLast {
|
doLast {
|
||||||
val file = launcher.get().asFile
|
val file = launcher.get().asFile
|
||||||
file.parentFile.mkdirs()
|
file.parentFile.mkdirs()
|
||||||
val connection = URI("https://api.purpurmc.org/v2/purpur/26.2/2618/download")
|
val connection = URI("https://api.purpurmc.org/v2/purpur/26.3/2651/download")
|
||||||
.toURL().openConnection()
|
.toURL().openConnection()
|
||||||
connection.connectTimeout = 30_000
|
connection.connectTimeout = 30_000
|
||||||
connection.readTimeout = 120_000
|
connection.readTimeout = 120_000
|
||||||
val bytes = connection.getInputStream().use { it.readBytes() }
|
val bytes = connection.getInputStream().use { it.readBytes() }
|
||||||
val digest = MessageDigest.getInstance("SHA-256").digest(bytes)
|
val digest = MessageDigest.getInstance("SHA-256").digest(bytes)
|
||||||
.joinToString("") { "%02x".format(it) }
|
.joinToString("") { "%02x".format(it) }
|
||||||
check(digest == "4a32d046a118804d89ca74ba89b798c98f6d8d1f310c18077ac573597049de31") {
|
check(digest == "0677c1febecfbc2e5b0a7f76abd647b70a1f38d3cbdf3dd6a82e401b4262a598") {
|
||||||
"Purpur 2618 checksum mismatch"
|
"Purpur 2651 checksum mismatch"
|
||||||
}
|
}
|
||||||
file.writeBytes(bytes)
|
file.writeBytes(bytes)
|
||||||
}
|
}
|
||||||
@@ -76,7 +76,7 @@ val downloadCarryRuntime = tasks.register("downloadCarryRuntime") {
|
|||||||
val prepareCarryRuntime = tasks.register<JavaExec>("prepareCarryRuntime") {
|
val prepareCarryRuntime = tasks.register<JavaExec>("prepareCarryRuntime") {
|
||||||
dependsOn(downloadCarryRuntime)
|
dependsOn(downloadCarryRuntime)
|
||||||
javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(25) }
|
javaLauncher = javaToolchains.launcherFor { languageVersion = JavaLanguageVersion.of(25) }
|
||||||
classpath = files(carryRuntime.map { it.file("purpur-26.2-2618.jar") })
|
classpath = files(carryRuntime.map { it.file("purpur-26.3-2651.jar") })
|
||||||
mainClass = "io.papermc.paperclip.Main"
|
mainClass = "io.papermc.paperclip.Main"
|
||||||
jvmArgs("-Dpaperclip.patchonly=true")
|
jvmArgs("-Dpaperclip.patchonly=true")
|
||||||
workingDir(carryRuntime)
|
workingDir(carryRuntime)
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ import org.junit.jupiter.api.BeforeAll;
|
|||||||
import org.junit.jupiter.api.BeforeEach;
|
import org.junit.jupiter.api.BeforeEach;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
/** Actual Purpur 2618 listener discovery and event dispatch with entity boundaries doubled. */
|
/** Actual Purpur 2651 listener discovery and event dispatch with entity boundaries doubled. */
|
||||||
class NativeCarryRoutingTest {
|
class NativeCarryRoutingTest {
|
||||||
private static Server previousServer;
|
private static Server previousServer;
|
||||||
private PluginManager events;
|
private PluginManager events;
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
|
|||||||
import java.io.DataInputStream;
|
import java.io.DataInputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
@@ -48,9 +49,18 @@ final class PurpurCarryDistributionTest {
|
|||||||
input.readUnsignedShort();
|
input.readUnsignedShort();
|
||||||
assertEquals(69, input.readUnsignedShort());
|
assertEquals(69, input.readUnsignedShort());
|
||||||
}
|
}
|
||||||
|
List<String> forbiddenPrefixes = List.of(
|
||||||
|
"com/comphenix/protocol/",
|
||||||
|
"com/destroystokyo/paper/",
|
||||||
|
"io/papermc/",
|
||||||
|
"net/minecraft/",
|
||||||
|
"org/bukkit/",
|
||||||
|
"org/purpurmc/",
|
||||||
|
"org/spigotmc/",
|
||||||
|
"mockito-extensions/"
|
||||||
|
);
|
||||||
assertFalse(jar.stream().anyMatch(entry ->
|
assertFalse(jar.stream().anyMatch(entry ->
|
||||||
entry.getName().startsWith("org/bukkit/")
|
forbiddenPrefixes.stream().anyMatch(entry.getName()::startsWith)
|
||||||
|| entry.getName().startsWith("org/purpurmc/")
|
|
||||||
|| entry.getName().endsWith("Test.class")));
|
|| entry.getName().endsWith("Test.class")));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -62,8 +72,16 @@ final class PurpurCarryDistributionTest {
|
|||||||
|
|
||||||
assertTrue(build.contains("nativeCarryTest"));
|
assertTrue(build.contains("nativeCarryTest"));
|
||||||
assertTrue(build.contains("tasks.check { dependsOn(nativeCarryTest) }"));
|
assertTrue(build.contains("tasks.check { dependsOn(nativeCarryTest) }"));
|
||||||
|
assertTrue(build.contains("purpur-api:26.3.build.2651-stable"));
|
||||||
|
assertTrue(build.contains("purpur-26.3-2651.jar"));
|
||||||
|
assertTrue(build.contains("https://api.purpurmc.org/v2/purpur/26.3/2651/download"));
|
||||||
assertTrue(build.contains(
|
assertTrue(build.contains(
|
||||||
"4a32d046a118804d89ca74ba89b798c98f6d8d1f310c18077ac573597049de31"));
|
"0677c1febecfbc2e5b0a7f76abd647b70a1f38d3cbdf3dd6a82e401b4262a598"));
|
||||||
|
assertFalse(build.contains("26.2"));
|
||||||
|
assertFalse(build.contains("2618"));
|
||||||
|
assertTrue(readme.contains("Purpur 26.3 build 2651"));
|
||||||
|
assertFalse(readme.contains("Purpur 26.2"));
|
||||||
|
assertFalse(readme.contains("2618"));
|
||||||
assertTrue(readme.contains("checksum-pinned Purpur event/command suite"));
|
assertTrue(readme.contains("checksum-pinned Purpur event/command suite"));
|
||||||
assertTrue(readme.contains("patch-only mode"));
|
assertTrue(readme.contains("patch-only mode"));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user