From b48dacbca2a457e4b34aea0cc169e6c591c374a5 Mon Sep 17 00:00:00 2001 From: Scheuraa007 <62388177+Scheuraa007@users.noreply.github.com> Date: Sun, 28 Sep 2025 11:43:54 +0200 Subject: [PATCH 1/5] test(all commands): Add tests for all commands --- build.gradle.kts | 13 +++ settings.gradle.kts | 10 +- .../labyrinth/commands/CenterCommandTest.java | 98 ++++++++++++++++ .../commands/CommandPluginTestBase.java | 38 ++++++ .../commands/CreateZoneCommandTest.java | 49 ++++++++ .../commands/DeleteZoneCommandTest.java | 50 ++++++++ .../commands/SetRadiusCommandTest.java | 95 +++++++++++++++ .../commands/ToggleMobSpawnCommandTest.java | 109 ++++++++++++++++++ .../impl/ValidationServiceImplTest.java | 84 ++++++++++++++ 9 files changed, 545 insertions(+), 1 deletion(-) create mode 100644 src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java create mode 100644 src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java create mode 100644 src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java create mode 100644 src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java create mode 100644 src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java create mode 100644 src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java create mode 100644 src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java diff --git a/build.gradle.kts b/build.gradle.kts index 0512d07..8f040df 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,11 @@ dependencies { implementation(libs.adventurePlatformBukkit) implementation(libs.paper) + testImplementation(platform(libs.junit.bom)) + testImplementation(libs.junit.jupiter) + testImplementation(libs.junit.platform.launcher) + testRuntimeOnly(libs.junit.jupiter.engine) + testImplementation(libs.mockbukkit) } java { sourceCompatibility = JavaVersion.VERSION_21 @@ -37,6 +42,14 @@ tasks { archiveClassifier.set("") archiveFileName.set("labyrinth.jar") } + + test { + useJUnitPlatform() + jvmArgs("-Dlabyrinth.insideTest=true") + testLogging { + events("passed", "skipped", "failed") + } + } } publishing { diff --git a/settings.gradle.kts b/settings.gradle.kts index d8b3355..be8f6bb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -4,11 +4,13 @@ dependencyResolutionManagement { versionCatalogs { create("libs") { - version("paper", "1.20.6-R0.1-SNAPSHOT") + version("paper", "1.21.8-R0.1-SNAPSHOT") version("plugin.yml", "0.6.0") version("run-paper", "3.0.2") version("publishdata", "1.4.0") version("shadow", "9.3.0") + version("junit-bom", "5.13.4") + version("mockbukit", "4.76.0") plugin("plugin.yml", "net.minecrell.plugin-yml.paper").versionRef("plugin.yml") plugin("run.paper", "xyz.jpenilla.run-paper").versionRef("run-paper") @@ -22,6 +24,12 @@ dependencyResolutionManagement { library("paper", "io.papermc.paper", "paper-api").versionRef("paper") + library("junit-bom", "org.junit", "junit-bom").versionRef("junit-bom") + library("junit-jupiter", "org.junit.jupiter", "junit-jupiter").withoutVersion() + library("junit-jupiter-engine", "org.junit.jupiter", "junit-jupiter-engine").withoutVersion() + library("junit.platform.launcher", "org.junit.platform", "junit-platform-launcher").withoutVersion() + library("mockbukkit", "org.mockbukkit.mockbukkit", "mockbukkit-v1.21").versionRef("mockbukit") + } } repositories { diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java new file mode 100644 index 0000000..32a761c --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java @@ -0,0 +1,98 @@ +package net.onelitefeather.labyrinth.commands; + +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.onelitefeather.labyrinth.service.api.ValidationService; +import net.onelitefeather.labyrinth.utils.Constants; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.*; +import org.mockbukkit.mockbukkit.world.WorldMock; + +class CenterCommandTest extends CommandPluginTestBase { + + private CenterCommand command; + private MockValidationService validationService; + + public static class MockValidationService implements ValidationService + { + private boolean isValid; + + @Override + public boolean validateZoneInput(@NotNull Player player, @NotNull String zone) { + return isValid; + } + + public void setValid(boolean valid) { + isValid = valid; + } + + public boolean isValid() { + return isValid; + } + } + + @Override + @BeforeEach + void setUp() + { + super.setUp(); + validationService = new MockValidationService(); + command = new CenterCommand(plugin, validationService); + } + + + @DisplayName("Test if the player location is not zero") + @Test + void testIsYLocationFromPlayerNotZero() + { + var player = server.addPlayer(); + var location = new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120); + player.setLocation(location); + + command.centerCommand(player, "Test"); + Assertions.assertNotEquals(0, location.getY()); + } + + @Test + void testValidationWrong() + { + var player = server.addPlayer(); + var location = new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120); + player.setLocation(location); + + validationService.setValid(false); + command.centerCommand(player, "Test"); + var playerMessage = player.nextComponentMessage(); + Assertions.assertNotNull(playerMessage); + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, + Placeholder.component("prefix", Constants.PREFIX)); + Assertions.assertEquals(expectedMessage, playerMessage); + Assertions.assertFalse(plugin.getConfig().contains(Constants.CONFIG_ZONE_CENTER_PATH.formatted("Test"))); + } + + @Test + void testValidationTrue() + { + var player = server.addPlayer(); + var location = new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.CENTER_COMMAND_MESSAGE_SUCCESS, + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX)); + + player.setLocation(location); + validationService.setValid(true); + command.centerCommand(player, zoneName); + location.setY(0); + var playerMessage = player.nextComponentMessage(); + + Assertions.assertNotNull(playerMessage); + Assertions.assertEquals(expectedMessage, playerMessage); + Assertions.assertTrue(plugin.getConfig().contains(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName))); + Assertions.assertEquals(location, plugin.getConfig().getLocation(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName))); + } + +} \ No newline at end of file diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java b/src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java new file mode 100644 index 0000000..92841bd --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java @@ -0,0 +1,38 @@ +package net.onelitefeather.labyrinth.commands; + +import net.onelitefeather.labyrinth.Labyrinth; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; + +public abstract class CommandPluginTestBase { + protected @NotNull ServerMock server; + protected Labyrinth plugin; + + public static class MockLabyrinthPlugin extends Labyrinth { + @Override + public void onEnable() { + + } + + @Override + public void onDisable() { + + } + } + + @BeforeEach + void setUp() + { + server = MockBukkit.mock(); + plugin = MockBukkit.load(CommandPluginTestBase.MockLabyrinthPlugin.class); + } + + @AfterEach + void tearDown() + { + MockBukkit.unmock(); + } +} diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java new file mode 100644 index 0000000..691231e --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java @@ -0,0 +1,49 @@ +package net.onelitefeather.labyrinth.commands; + +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.onelitefeather.labyrinth.utils.Constants; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class CreateZoneCommandTest extends CommandPluginTestBase { + + private CreateZoneCommand command; + + @Override + @BeforeEach + void setUp() + { + super.setUp(); + command = new CreateZoneCommand(plugin); + } + + @Test + void testZoneNameNotMatchesPattern() + { + var player = server.addPlayer(); + var zoneName = "Test%"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, + Placeholder.component("prefix", Constants.PREFIX)); + command.createZone(player, zoneName); + + assertFalse(plugin.getConfig().isSet(Constants.CONFIG_ZONE_PATH.formatted(zoneName))); + assertEquals(expectedMessage, player.nextComponentMessage()); + } + + @Test + void testZoneCreated() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.CREATE_ZONE_MESSAGE_SUCCESS, + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX)); + command.createZone(player, zoneName); + + assertTrue(plugin.getConfig().isSet(Constants.CONFIG_ZONE_PATH.formatted(zoneName))); + assertEquals(expectedMessage, player.nextComponentMessage()); + } +} \ No newline at end of file diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java new file mode 100644 index 0000000..c6ab0fa --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java @@ -0,0 +1,50 @@ +package net.onelitefeather.labyrinth.commands; + +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.onelitefeather.labyrinth.utils.Constants; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class DeleteZoneCommandTest extends CommandPluginTestBase{ + + private DeleteZoneCommand command; + + @Override + @BeforeEach + void setUp() + { + super.setUp(); + command = new DeleteZoneCommand(plugin); + } + + @Test + void testZoneDeleted() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.DELETE_ZONE_MESSAGE_SUCCESS, + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX)); + var configSectionName = Constants.CONFIG_ZONE_PATH.formatted(zoneName); + plugin.getConfig().createSection(configSectionName); + command.deleteZone(player, zoneName); + assertFalse(plugin.getConfig().isSet(configSectionName)); + assertEquals(expectedMessage, player.nextComponentMessage()); + } + + @Test + void testZoneNotDeleted() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, + Placeholder.component("prefix", Constants.PREFIX)); + command.deleteZone(player, zoneName); + assertEquals(expectedMessage, player.nextComponentMessage()); + + } + +} \ No newline at end of file diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java new file mode 100644 index 0000000..46a7b20 --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java @@ -0,0 +1,95 @@ +package net.onelitefeather.labyrinth.commands; + +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.onelitefeather.labyrinth.service.api.ValidationService; +import net.onelitefeather.labyrinth.utils.Constants; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockbukkit.mockbukkit.world.WorldMock; + +import static org.junit.jupiter.api.Assertions.*; + +class SetRadiusCommandTest extends CommandPluginTestBase{ + + private SetRadiusCommand command; + private SetRadiusCommandTest.MockValidationService validationService; + + public static class MockValidationService implements ValidationService + { + private boolean isValid; + + @Override + public boolean validateZoneInput(@NotNull Player player, @NotNull String zone) { + return isValid; + } + + public void setValid(boolean valid) { + isValid = valid; + } + + public boolean isValid() { + return isValid; + } + } + + @Override + @BeforeEach + void setUp() + { + super.setUp(); + validationService = new SetRadiusCommandTest.MockValidationService(); + command = new SetRadiusCommand(plugin, validationService); + } + + @Test + void testValidationWrong() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, + Placeholder.component("prefix", Constants.PREFIX)); + validationService.setValid(false); + command.setRadius(player, zoneName); + assertEquals(expectedMessage, player.nextComponentMessage()); + } + + @Test + void testNoLocationSet() + { + var player = server.addPlayer(); + var zoneName = "Test"; + validationService.setValid(true); + command.setRadius(player, zoneName); + assertNull(player.nextComponentMessage()); + } + + @Test + void testRadiusSet() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.SET_RADIUS_MESSAGE, + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX)); + var world = new WorldMock(Material.GRASS_BLOCK, 64); + var centerLocation = new Location(world, 120, 0, 120); + var playerLocation = new Location(world, 240, 64, 240); + + validationService.setValid(true); + plugin.getConfig().set(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName), centerLocation); + player.setLocation(playerLocation); + + command.setRadius(player,zoneName); + + playerLocation.setY(0); + var expectedDistance = centerLocation.distance(playerLocation); + assertEquals(expectedDistance, plugin.getConfig().getDouble(Constants.CONFIG_ZONE_RADIUS_PATH.formatted(zoneName))); + assertEquals(expectedMessage, player.nextComponentMessage()); + } + +} \ No newline at end of file diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java new file mode 100644 index 0000000..8228c62 --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java @@ -0,0 +1,109 @@ +package net.onelitefeather.labyrinth.commands; + +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.onelitefeather.labyrinth.service.api.ValidationService; +import net.onelitefeather.labyrinth.utils.Constants; +import org.bukkit.entity.Player; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.*; + +class ToggleMobSpawnCommandTest extends CommandPluginTestBase{ + + private ToggleMobSpawnCommand command; + private ToggleMobSpawnCommandTest.MockValidationService validationService; + + public static class MockValidationService implements ValidationService + { + private boolean isValid; + + @Override + public boolean validateZoneInput(@NotNull Player player, @NotNull String zone) { + return isValid; + } + + public void setValid(boolean valid) { + isValid = valid; + } + + public boolean isValid() { + return isValid; + } + } + + @Override + @BeforeEach + void setUp() + { + super.setUp(); + validationService = new ToggleMobSpawnCommandTest.MockValidationService(); + command = new ToggleMobSpawnCommand(plugin, validationService); + } + + @Test + void testZoneNotValid() + { + var player = server.addPlayer(); + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, + Placeholder.component("prefix", Constants.PREFIX)); + + validationService.setValid(false); + + command.toggleMobSpawn(player, "Test"); + assertEquals(expectedMessage, player.nextComponentMessage()); + } + + @Test + void testActivateMobSpawningWithNotSetInConfig() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.TOGGLE_MOB_SPAWN_COMMAND_MESSAGE_SUCCESS, + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX), + Placeholder.unparsed("value", String.valueOf(true))); + validationService.setValid(true); + + command.toggleMobSpawn(player, zoneName); + assertEquals(expectedMessage, player.nextComponentMessage()); + assertTrue(plugin.getConfig().getBoolean(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName))); + } + + @Test + void testMobSpawningChangedToTrue() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.TOGGLE_MOB_SPAWN_COMMAND_MESSAGE_SUCCESS, + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX), + Placeholder.unparsed("value", String.valueOf(true))); + plugin.getConfig().set(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName), false); + validationService.setValid(true); + + command.toggleMobSpawn(player, zoneName); + assertEquals(expectedMessage, player.nextComponentMessage()); + assertTrue(plugin.getConfig().getBoolean(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName))); + } + + @Test + void testMobSpawningChangedToFalse() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.TOGGLE_MOB_SPAWN_COMMAND_MESSAGE_SUCCESS, + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX), + Placeholder.unparsed("value", String.valueOf(false))); + plugin.getConfig().set(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName), true); + validationService.setValid(true); + + command.toggleMobSpawn(player, zoneName); + assertEquals(expectedMessage, player.nextComponentMessage()); + assertFalse(plugin.getConfig().getBoolean(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName))); + } + +} \ No newline at end of file diff --git a/src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java b/src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java new file mode 100644 index 0000000..b298e8f --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java @@ -0,0 +1,84 @@ +package net.onelitefeather.labyrinth.service.impl; + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.minimessage.MiniMessage; +import net.kyori.adventure.text.minimessage.tag.resolver.Placeholder; +import net.onelitefeather.labyrinth.Labyrinth; +import net.onelitefeather.labyrinth.utils.Constants; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; + +import static org.junit.jupiter.api.Assertions.*; + +class ValidationServiceImplTest { + + private @NotNull ServerMock server; + private Labyrinth plugin; + private ValidationServiceImpl validationService; + + public static class MockLabyrinthPlugin extends Labyrinth + { + @Override + public void onEnable() { + + } + + @Override + public void onDisable() { + + } + } + + @BeforeEach + void setUp() + { + server = MockBukkit.mock(); + plugin = MockBukkit.load(ValidationServiceImplTest.MockLabyrinthPlugin.class); + validationService = new ValidationServiceImpl(plugin); + } + + @AfterEach + void tearDown() + { + MockBukkit.unmock(); + } + + @Test + void testZoneNotFound() + { + var player = server.addPlayer(); + var zoneName = "Test"; + var expectedMessage = MiniMessage.miniMessage().deserialize( + "Zone could not be found!", Placeholder.unparsed("zone", zoneName)); + var validationSuccessful = validationService.validateZoneInput(player, zoneName); + assertFalse(validationSuccessful); + assertEquals(expectedMessage, player.nextComponentMessage()); + } + + @Test + void testZoneValid() + { + var player = server.addPlayer(); + var zoneName = "Test"; + plugin.getConfig().createSection(Constants.CONFIG_ZONE_PATH.formatted(zoneName)); + var validationSuccessful = validationService.validateZoneInput(player, zoneName); + assertTrue(validationSuccessful); + } + + @Test + void testZoneNameNotMatchesPattern() + { + var player = server.addPlayer(); + var zoneName = "Test%"; + var expectedMessage = Component.text("Only characters without symbols are allowed"); + plugin.getConfig().createSection(Constants.CONFIG_ZONE_PATH.formatted(zoneName)); + var validationSuccessful = validationService.validateZoneInput(player, zoneName); + assertFalse(validationSuccessful); + assertEquals(expectedMessage, player.nextComponentMessage()); + } + +} \ No newline at end of file From fcf6a4a543521703215cd2ac5b146cf07a1f0ee3 Mon Sep 17 00:00:00 2001 From: Scheuraa007 <62388177+Scheuraa007@users.noreply.github.com> Date: Fri, 17 Oct 2025 11:35:30 +0200 Subject: [PATCH 2/5] test(listeners): Add test for the MobspawnListener --- .../listener/MobspawnListenerTest.java | 166 ++++++++++++++++++ 1 file changed, 166 insertions(+) create mode 100644 src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java diff --git a/src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java b/src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java new file mode 100644 index 0000000..6dbf543 --- /dev/null +++ b/src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java @@ -0,0 +1,166 @@ +package net.onelitefeather.labyrinth.listener; + +import net.onelitefeather.labyrinth.Labyrinth; +import net.onelitefeather.labyrinth.utils.Constants; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.event.entity.EntitySpawnEvent; +import org.jetbrains.annotations.NotNull; +import org.junit.jupiter.api.AfterEach; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.mockbukkit.mockbukkit.MockBukkit; +import org.mockbukkit.mockbukkit.ServerMock; +import org.mockbukkit.mockbukkit.entity.SheepMock; +import org.mockbukkit.mockbukkit.entity.ZombieMock; +import org.mockbukkit.mockbukkit.world.WorldMock; + +import java.util.UUID; + +import static org.junit.jupiter.api.Assertions.*; + +class MobspawnListenerTest { + + private @NotNull ServerMock server; + private Labyrinth plugin; + private MobspawnListener listener; + + public static class MockLabyrinthPlugin extends Labyrinth { + @Override + public void onEnable() { + + } + + @Override + public void onDisable() { + + } + } + + @BeforeEach + void setUp() + { + server = MockBukkit.mock(); + plugin = MockBukkit.load(MobspawnListenerTest.MockLabyrinthPlugin.class); + listener = new MobspawnListener(this.plugin); + } + + @AfterEach + void tearDown() + { + MockBukkit.unmock(); + } + + @Test + void testNoZone() + { + this.server.getPluginManager().registerEvents(listener, this.plugin); + var zombie = new ZombieMock(this.server, UUID.randomUUID()); + zombie.setLocation(new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120)); + var event = new EntitySpawnEvent(zombie); + this.server.getPluginManager().callEvent(event); + assertFalse(event.isCancelled()); + } + + @Test + void testNoCenterLocation() + { + this.server.getPluginManager().registerEvents(listener, this.plugin); + var zombie = new ZombieMock(this.server, UUID.randomUUID()); + zombie.setLocation(new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120)); + var zoneName = "Test"; + var configSectionName = Constants.CONFIG_ZONE_PATH.formatted(zoneName); + plugin.getConfig().createSection(configSectionName); + var event = new EntitySpawnEvent(zombie); + this.server.getPluginManager().callEvent(event); + assertFalse(event.isCancelled()); + } + + @Test + void testNotInRadius() + { + this.server.getPluginManager().registerEvents(listener, this.plugin); + + var world = new WorldMock(Material.GRASS_BLOCK, 64); + var zombie = new ZombieMock(this.server, UUID.randomUUID()); + zombie.setLocation(new Location(world, 10, 64, 10)); + var zoneName = "Test"; + var configSectionName = Constants.CONFIG_ZONE_PATH.formatted(zoneName); + plugin.getConfig().createSection(configSectionName); + + var centerLocation = new Location(world, 120, 0, 120); + plugin.getConfig().set(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName), centerLocation); + plugin.getConfig().set(Constants.CONFIG_ZONE_RADIUS_PATH.formatted(zoneName), 5d); + + var event = new EntitySpawnEvent(zombie); + this.server.getPluginManager().callEvent(event); + assertFalse(event.isCancelled()); + } + + @Test + void testNotDisabled() + { + this.server.getPluginManager().registerEvents(listener, this.plugin); + + var world = new WorldMock(Material.GRASS_BLOCK, 64); + var zombie = new ZombieMock(this.server, UUID.randomUUID()); + zombie.setLocation(new Location(world, 119, 64, 120)); + var zoneName = "Test"; + var configSectionName = Constants.CONFIG_ZONE_PATH.formatted(zoneName); + plugin.getConfig().createSection(configSectionName); + + var centerLocation = new Location(world, 120, 0, 120); + plugin.getConfig().set(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName), centerLocation); + plugin.getConfig().set(Constants.CONFIG_ZONE_RADIUS_PATH.formatted(zoneName), 5d); + plugin.getConfig().set(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName), true); + + var event = new EntitySpawnEvent(zombie); + this.server.getPluginManager().callEvent(event); + assertFalse(event.isCancelled()); + } + + @Test + void testNoSpawning() + { + this.server.getPluginManager().registerEvents(listener, this.plugin); + + var world = new WorldMock(Material.GRASS_BLOCK, 64); + var zombie = new ZombieMock(this.server, UUID.randomUUID()); + zombie.setLocation(new Location(world, 119, 64, 120)); + var zoneName = "Test"; + var configSectionName = Constants.CONFIG_ZONE_PATH.formatted(zoneName); + plugin.getConfig().createSection(configSectionName); + + var centerLocation = new Location(world, 120, 0, 120); + plugin.getConfig().set(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName), centerLocation); + plugin.getConfig().set(Constants.CONFIG_ZONE_RADIUS_PATH.formatted(zoneName), 5d); + plugin.getConfig().set(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName), false); + + var event = new EntitySpawnEvent(zombie); + this.server.getPluginManager().callEvent(event); + assertTrue(event.isCancelled()); + } + + @Test + void testNoMonster() + { + this.server.getPluginManager().registerEvents(listener, this.plugin); + + var world = new WorldMock(Material.GRASS_BLOCK, 64); + var sheep = new SheepMock(this.server, UUID.randomUUID()); + sheep.setLocation(new Location(world, 119, 64, 120)); + var zoneName = "Test"; + var configSectionName = Constants.CONFIG_ZONE_PATH.formatted(zoneName); + plugin.getConfig().createSection(configSectionName); + + var centerLocation = new Location(world, 120, 0, 120); + plugin.getConfig().set(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName), centerLocation); + plugin.getConfig().set(Constants.CONFIG_ZONE_RADIUS_PATH.formatted(zoneName), 5d); + plugin.getConfig().set(Constants.CONFIG_ZONE_MOBSPAWNING_PATH.formatted(zoneName), false); + + var event = new EntitySpawnEvent(sheep); + this.server.getPluginManager().callEvent(event); + assertFalse(event.isCancelled()); + } + +} \ No newline at end of file From 076dbb7d399e4481a11425b247e01ea17218ca5c Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Sun, 1 Feb 2026 17:23:27 +0100 Subject: [PATCH 3/5] chore(build): improve dependency ordering and plugin usage --- build.gradle.kts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 8f040df..abb6d3a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,10 +1,9 @@ plugins { - id("java") + java + `maven-publish` alias(libs.plugins.run.paper) alias(libs.plugins.plugin.yml) alias(libs.plugins.shadow) - - `maven-publish` } dependencies { @@ -17,9 +16,11 @@ dependencies { testImplementation(platform(libs.junit.bom)) testImplementation(libs.junit.jupiter) testImplementation(libs.junit.platform.launcher) - testRuntimeOnly(libs.junit.jupiter.engine) testImplementation(libs.mockbukkit) + + testRuntimeOnly(libs.junit.jupiter.engine) } + java { sourceCompatibility = JavaVersion.VERSION_21 targetCompatibility = JavaVersion.VERSION_21 @@ -102,7 +103,6 @@ publishing { } paper { - main = "net.onelitefeather.labyrinth.Labyrinth" name = "Labyrinth" description = "This is a prototype plugin for the Labyrinth of our Survival Server" @@ -130,7 +130,5 @@ paper { register("labyrinth.setup.deletezone") { description = "This permission is needed to delete the zone." } - } } - From a5427c88448ec40d0cc7475a0e3d46f9ebe92a8e Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Sun, 1 Feb 2026 17:26:11 +0100 Subject: [PATCH 4/5] style(test): adjust bracket placement in tests --- .../labyrinth/commands/CenterCommandTest.java | 15 ++++-------- .../commands/CommandPluginTestBase.java | 6 ++--- .../commands/CreateZoneCommandTest.java | 11 ++++----- .../commands/DeleteZoneCommandTest.java | 15 +++++------- .../commands/SetRadiusCommandTest.java | 21 +++++++--------- .../commands/ToggleMobSpawnCommandTest.java | 20 ++++++---------- .../listener/MobspawnListenerTest.java | 24 +++++++------------ .../impl/ValidationServiceImplTest.java | 18 +++++--------- 8 files changed, 46 insertions(+), 84 deletions(-) diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java index 32a761c..7e68b9d 100644 --- a/src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java +++ b/src/test/java/net/onelitefeather/labyrinth/commands/CenterCommandTest.java @@ -16,8 +16,7 @@ class CenterCommandTest extends CommandPluginTestBase { private CenterCommand command; private MockValidationService validationService; - public static class MockValidationService implements ValidationService - { + public static class MockValidationService implements ValidationService { private boolean isValid; @Override @@ -36,8 +35,7 @@ public boolean isValid() { @Override @BeforeEach - void setUp() - { + void setUp() { super.setUp(); validationService = new MockValidationService(); command = new CenterCommand(plugin, validationService); @@ -46,8 +44,7 @@ void setUp() @DisplayName("Test if the player location is not zero") @Test - void testIsYLocationFromPlayerNotZero() - { + void testIsYLocationFromPlayerNotZero() { var player = server.addPlayer(); var location = new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120); player.setLocation(location); @@ -57,8 +54,7 @@ void testIsYLocationFromPlayerNotZero() } @Test - void testValidationWrong() - { + void testValidationWrong() { var player = server.addPlayer(); var location = new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120); player.setLocation(location); @@ -74,8 +70,7 @@ void testValidationWrong() } @Test - void testValidationTrue() - { + void testValidationTrue() { var player = server.addPlayer(); var location = new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120); var zoneName = "Test"; diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java b/src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java index 92841bd..43a1f56 100644 --- a/src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java +++ b/src/test/java/net/onelitefeather/labyrinth/commands/CommandPluginTestBase.java @@ -24,15 +24,13 @@ public void onDisable() { } @BeforeEach - void setUp() - { + void setUp() { server = MockBukkit.mock(); plugin = MockBukkit.load(CommandPluginTestBase.MockLabyrinthPlugin.class); } @AfterEach - void tearDown() - { + void tearDown() { MockBukkit.unmock(); } } diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java index 691231e..563d799 100644 --- a/src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java +++ b/src/test/java/net/onelitefeather/labyrinth/commands/CreateZoneCommandTest.java @@ -14,19 +14,17 @@ class CreateZoneCommandTest extends CommandPluginTestBase { @Override @BeforeEach - void setUp() - { + void setUp() { super.setUp(); command = new CreateZoneCommand(plugin); } @Test - void testZoneNameNotMatchesPattern() - { + void testZoneNameNotMatchesPattern() { var player = server.addPlayer(); var zoneName = "Test%"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, - Placeholder.component("prefix", Constants.PREFIX)); + Placeholder.component("prefix", Constants.PREFIX)); command.createZone(player, zoneName); assertFalse(plugin.getConfig().isSet(Constants.CONFIG_ZONE_PATH.formatted(zoneName))); @@ -34,8 +32,7 @@ void testZoneNameNotMatchesPattern() } @Test - void testZoneCreated() - { + void testZoneCreated() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.CREATE_ZONE_MESSAGE_SUCCESS, diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java index c6ab0fa..4f9d70b 100644 --- a/src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java +++ b/src/test/java/net/onelitefeather/labyrinth/commands/DeleteZoneCommandTest.java @@ -8,26 +8,24 @@ import static org.junit.jupiter.api.Assertions.*; -class DeleteZoneCommandTest extends CommandPluginTestBase{ +class DeleteZoneCommandTest extends CommandPluginTestBase { private DeleteZoneCommand command; @Override @BeforeEach - void setUp() - { + void setUp() { super.setUp(); command = new DeleteZoneCommand(plugin); } @Test - void testZoneDeleted() - { + void testZoneDeleted() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.DELETE_ZONE_MESSAGE_SUCCESS, - Placeholder.unparsed("zone", zoneName), - Placeholder.component("prefix", Constants.PREFIX)); + Placeholder.unparsed("zone", zoneName), + Placeholder.component("prefix", Constants.PREFIX)); var configSectionName = Constants.CONFIG_ZONE_PATH.formatted(zoneName); plugin.getConfig().createSection(configSectionName); command.deleteZone(player, zoneName); @@ -36,8 +34,7 @@ void testZoneDeleted() } @Test - void testZoneNotDeleted() - { + void testZoneNotDeleted() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java index 46a7b20..2216c8b 100644 --- a/src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java +++ b/src/test/java/net/onelitefeather/labyrinth/commands/SetRadiusCommandTest.java @@ -14,13 +14,12 @@ import static org.junit.jupiter.api.Assertions.*; -class SetRadiusCommandTest extends CommandPluginTestBase{ +class SetRadiusCommandTest extends CommandPluginTestBase { private SetRadiusCommand command; private SetRadiusCommandTest.MockValidationService validationService; - public static class MockValidationService implements ValidationService - { + public static class MockValidationService implements ValidationService { private boolean isValid; @Override @@ -39,16 +38,14 @@ public boolean isValid() { @Override @BeforeEach - void setUp() - { + void setUp() { super.setUp(); validationService = new SetRadiusCommandTest.MockValidationService(); command = new SetRadiusCommand(plugin, validationService); } @Test - void testValidationWrong() - { + void testValidationWrong() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, @@ -59,8 +56,7 @@ void testValidationWrong() } @Test - void testNoLocationSet() - { + void testNoLocationSet() { var player = server.addPlayer(); var zoneName = "Test"; validationService.setValid(true); @@ -69,8 +65,7 @@ void testNoLocationSet() } @Test - void testRadiusSet() - { + void testRadiusSet() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.SET_RADIUS_MESSAGE, @@ -84,11 +79,11 @@ void testRadiusSet() plugin.getConfig().set(Constants.CONFIG_ZONE_CENTER_PATH.formatted(zoneName), centerLocation); player.setLocation(playerLocation); - command.setRadius(player,zoneName); + command.setRadius(player, zoneName); playerLocation.setY(0); var expectedDistance = centerLocation.distance(playerLocation); - assertEquals(expectedDistance, plugin.getConfig().getDouble(Constants.CONFIG_ZONE_RADIUS_PATH.formatted(zoneName))); + assertEquals(expectedDistance, plugin.getConfig().getDouble(Constants.CONFIG_ZONE_RADIUS_PATH.formatted(zoneName))); assertEquals(expectedMessage, player.nextComponentMessage()); } diff --git a/src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java b/src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java index 8228c62..dcf16a4 100644 --- a/src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java +++ b/src/test/java/net/onelitefeather/labyrinth/commands/ToggleMobSpawnCommandTest.java @@ -11,13 +11,12 @@ import static org.junit.jupiter.api.Assertions.*; -class ToggleMobSpawnCommandTest extends CommandPluginTestBase{ +class ToggleMobSpawnCommandTest extends CommandPluginTestBase { private ToggleMobSpawnCommand command; private ToggleMobSpawnCommandTest.MockValidationService validationService; - public static class MockValidationService implements ValidationService - { + public static class MockValidationService implements ValidationService { private boolean isValid; @Override @@ -36,16 +35,14 @@ public boolean isValid() { @Override @BeforeEach - void setUp() - { + void setUp() { super.setUp(); validationService = new ToggleMobSpawnCommandTest.MockValidationService(); command = new ToggleMobSpawnCommand(plugin, validationService); } @Test - void testZoneNotValid() - { + void testZoneNotValid() { var player = server.addPlayer(); var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.ZONE_INVALID_MESSAGE, Placeholder.component("prefix", Constants.PREFIX)); @@ -57,8 +54,7 @@ void testZoneNotValid() } @Test - void testActivateMobSpawningWithNotSetInConfig() - { + void testActivateMobSpawningWithNotSetInConfig() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.TOGGLE_MOB_SPAWN_COMMAND_MESSAGE_SUCCESS, @@ -73,8 +69,7 @@ void testActivateMobSpawningWithNotSetInConfig() } @Test - void testMobSpawningChangedToTrue() - { + void testMobSpawningChangedToTrue() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.TOGGLE_MOB_SPAWN_COMMAND_MESSAGE_SUCCESS, @@ -90,8 +85,7 @@ void testMobSpawningChangedToTrue() } @Test - void testMobSpawningChangedToFalse() - { + void testMobSpawningChangedToFalse() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize(Constants.TOGGLE_MOB_SPAWN_COMMAND_MESSAGE_SUCCESS, diff --git a/src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java b/src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java index 6dbf543..489f10c 100644 --- a/src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java +++ b/src/test/java/net/onelitefeather/labyrinth/listener/MobspawnListenerTest.java @@ -38,22 +38,19 @@ public void onDisable() { } @BeforeEach - void setUp() - { + void setUp() { server = MockBukkit.mock(); plugin = MockBukkit.load(MobspawnListenerTest.MockLabyrinthPlugin.class); listener = new MobspawnListener(this.plugin); } @AfterEach - void tearDown() - { + void tearDown() { MockBukkit.unmock(); } @Test - void testNoZone() - { + void testNoZone() { this.server.getPluginManager().registerEvents(listener, this.plugin); var zombie = new ZombieMock(this.server, UUID.randomUUID()); zombie.setLocation(new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120)); @@ -63,8 +60,7 @@ void testNoZone() } @Test - void testNoCenterLocation() - { + void testNoCenterLocation() { this.server.getPluginManager().registerEvents(listener, this.plugin); var zombie = new ZombieMock(this.server, UUID.randomUUID()); zombie.setLocation(new Location(new WorldMock(Material.GRASS_BLOCK, 64), 120, 64, 120)); @@ -77,8 +73,7 @@ void testNoCenterLocation() } @Test - void testNotInRadius() - { + void testNotInRadius() { this.server.getPluginManager().registerEvents(listener, this.plugin); var world = new WorldMock(Material.GRASS_BLOCK, 64); @@ -98,8 +93,7 @@ void testNotInRadius() } @Test - void testNotDisabled() - { + void testNotDisabled() { this.server.getPluginManager().registerEvents(listener, this.plugin); var world = new WorldMock(Material.GRASS_BLOCK, 64); @@ -120,8 +114,7 @@ void testNotDisabled() } @Test - void testNoSpawning() - { + void testNoSpawning() { this.server.getPluginManager().registerEvents(listener, this.plugin); var world = new WorldMock(Material.GRASS_BLOCK, 64); @@ -142,8 +135,7 @@ void testNoSpawning() } @Test - void testNoMonster() - { + void testNoMonster() { this.server.getPluginManager().registerEvents(listener, this.plugin); var world = new WorldMock(Material.GRASS_BLOCK, 64); diff --git a/src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java b/src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java index b298e8f..e11c10c 100644 --- a/src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java +++ b/src/test/java/net/onelitefeather/labyrinth/service/impl/ValidationServiceImplTest.java @@ -20,8 +20,7 @@ class ValidationServiceImplTest { private Labyrinth plugin; private ValidationServiceImpl validationService; - public static class MockLabyrinthPlugin extends Labyrinth - { + public static class MockLabyrinthPlugin extends Labyrinth { @Override public void onEnable() { @@ -34,22 +33,19 @@ public void onDisable() { } @BeforeEach - void setUp() - { + void setUp() { server = MockBukkit.mock(); plugin = MockBukkit.load(ValidationServiceImplTest.MockLabyrinthPlugin.class); validationService = new ValidationServiceImpl(plugin); } @AfterEach - void tearDown() - { + void tearDown() { MockBukkit.unmock(); } @Test - void testZoneNotFound() - { + void testZoneNotFound() { var player = server.addPlayer(); var zoneName = "Test"; var expectedMessage = MiniMessage.miniMessage().deserialize( @@ -60,8 +56,7 @@ void testZoneNotFound() } @Test - void testZoneValid() - { + void testZoneValid() { var player = server.addPlayer(); var zoneName = "Test"; plugin.getConfig().createSection(Constants.CONFIG_ZONE_PATH.formatted(zoneName)); @@ -70,8 +65,7 @@ void testZoneValid() } @Test - void testZoneNameNotMatchesPattern() - { + void testZoneNameNotMatchesPattern() { var player = server.addPlayer(); var zoneName = "Test%"; var expectedMessage = Component.text("Only characters without symbols are allowed"); From b7579e0bf63d0e02f32e42a4b0a84653f86ef960 Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Sun, 1 Feb 2026 17:34:52 +0100 Subject: [PATCH 5/5] chore(build): set used Minecraft version to 1.21.8 --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index abb6d3a..c93ac89 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -35,7 +35,7 @@ tasks { } runServer { - minecraftVersion("1.20.6") + minecraftVersion("1.21.8") jvmArgs("-Xmx2G", "-Dcom.mojang.eula.agree=true") }