Skip to content

Commit

Permalink
Removed deprecated initializeBlockData method
Browse files Browse the repository at this point in the history
  • Loading branch information
fulminazzo committed Dec 23, 2024
1 parent c200c63 commit 4ee9ca6
Showing 1 changed file with 2 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ protected void setUp() {
super.setUp();
setupServer();
setupEnchantments();
when(Bukkit.getServer().createBlockData(any(Material.class), any(String.class)))
.thenReturn(mock(org.bukkit.block.data.BlockData.class));
}

private static Particle[] getTestLegacyParticles() {
Expand Down Expand Up @@ -157,9 +159,6 @@ void testWorldSpawnParticle(Particle particle) {
}

private <T> void testSpawnParticle(Class<T> targetClass, Particle particle) {
// Initialize Bukkit variables
initializeBlockData();

T target = mock(targetClass);

final @NotNull Consumer<ArgumentCaptor<?>[]> captorsValidator;
Expand Down Expand Up @@ -431,7 +430,6 @@ void testInvalidOptionForMaterialData() {
@ParameterizedTest
@EnumSource(Material.class)
void testAllBlockData(Material material) {
initializeBlockData();
Executable executable = () -> WrappersAdapter.convertOption(org.bukkit.block.data.BlockData.class, material.name());
if (material.isBlock()) assertDoesNotThrow(executable);
else assertThrowsExactly(IllegalArgumentException.class, executable);
Expand All @@ -452,12 +450,6 @@ void testItemModuleNotProvided() {
}
}

private static void initializeBlockData() {
Server server = mock(Server.class);
when(server.createBlockData(any(Material.class), any(String.class))).thenReturn(mock(org.bukkit.block.data.BlockData.class));
new Refl<>(Bukkit.class).setFieldObject("server", server);
}

@SuppressWarnings("unused")
private static class MockDataType {

Expand Down

0 comments on commit 4ee9ca6

Please sign in to comment.