Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -89,19 +89,18 @@ val javaVersion = "25"
val junitVersion = "5.10.2"
val mockitoVersion = "5.11.0"
// MockBukkit's modern, per-Minecraft-version artifacts are published to Paper's Maven repo
// under org.mockbukkit.mockbukkit (see the testImplementation coordinate below). The closest
// available to Paper 26.2 is the 26.1.2 line (no 26.2 build exists yet); 4.113.2 is the latest.
val mockBukkitVersion = "4.113.2"
// under org.mockbukkit.mockbukkit (see the testImplementation coordinate below). 4.116.1 is the
// first release with a 26.2 artifact, built against 26.2.build.111-stable.
val mockBukkitVersion = "4.116.1"
val mongodbVersion = "3.12.12"
val mariadbVersion = "3.0.5"
val mysqlVersion = "8.0.27"
val postgresqlVersion = "42.2.18"
val hikaricpVersion = "5.0.1"
// Compile against the latest stable 26.1.2 dev bundle. This is the newest Paper API that has a
// matching MockBukkit release (mockbukkit-v26.1.2); MockBukkit does not yet support 26.2's new
// registries. Minecraft 26.2 is still fully supported at runtime (see ServerCompatibility and
// the Modrinth game-versions list); 26.2-only blocks/entities are accessed via Enums.getIfPresent.
val paperVersion = "26.1.2.build.72-stable"
// Compile against the 26.2 dev bundle MockBukkit 4.116.1 was built against, so the API under
// test and the API compiled against are the same. Note 26.2 brings Adventure 5, which makes
// ClickEvent generic (payload() rather than value()) and seals Component so it cannot be mocked.
val paperVersion = "26.2.build.111-stable"
val bstatsVersion = "3.0.0"
val vaultVersion = "1.7.1"
val levelVersion = "2.21.3"
Expand Down Expand Up @@ -257,7 +256,7 @@ dependencies {
testRuntimeOnly("org.junit.platform:junit-platform-launcher:$junitVersion")
testImplementation("org.mockito:mockito-junit-jupiter:$mockitoVersion")
testImplementation("org.mockito:mockito-core:$mockitoVersion")
testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v26.1.2:$mockBukkitVersion")
testImplementation("org.mockbukkit.mockbukkit:mockbukkit-v26.2:$mockBukkitVersion")
testImplementation("org.awaitility:awaitility:$awaitilityVersion")
testImplementation("io.papermc.paper:paper-api:$paperVersion")
testImplementation("com.github.MilkBowl:VaultAPI:$vaultVersion")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ void testOnPlayerChangeWorldNoFlag() {
*/
@Test
void testOnPlayerJoinWorld() {
Component component = mock(Component.class);
// Adventure 5 seals Component, so it cannot be mocked
Component component = Component.empty();
PlayerJoinEvent event = new PlayerJoinEvent(mockPlayer, component);
bed.onPlayerJoinWorld(event);
verify(block).setType(Material.END_PORTAL, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ class JoinLeaveListenerTest extends RanksManagerTestSetup {

private AddonDescription desc;

@Mock
private Component component;
// Adventure 5 seals Component, so join/quit messages are real components now
private final Component component = Component.empty();

@Override
@BeforeEach
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,11 @@ private void assertClickRuns(String command) {
}

private boolean hasClickRunning(Component component, String command) {
ClickEvent click = component.clickEvent();
if (click != null && click.action() == ClickEvent.Action.RUN_COMMAND && command.equals(click.value())) {
// Adventure 5 made the click event generic: what used to be a bare string value is
// now a typed payload
ClickEvent<?> click = component.clickEvent();
if (click != null && click.action() == ClickEvent.Action.RUN_COMMAND
&& click.payload() instanceof ClickEvent.Payload.Text text && command.equals(text.value())) {
return true;
}
return component.children().stream().anyMatch(child -> hasClickRunning(child, command));
Expand Down
Loading