From 04716439cd31e627a748ca7e2a16b2c8d8dfbdbd Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Tue, 5 May 2026 10:12:08 +0200 Subject: [PATCH 1/3] feat(map): add teleportToSpawn method without instance set option --- .../aves/map/provider/MapProvider.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java b/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java index 693ca98e..8f0aed06 100644 --- a/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java +++ b/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java @@ -3,6 +3,7 @@ import net.minestom.server.coordinate.Pos; import net.minestom.server.entity.Player; import net.minestom.server.instance.Instance; +import net.minestom.server.instance.anvil.AnvilLoader; import net.theevilreaper.aves.map.BaseMap; import net.theevilreaper.aves.map.MapEntry; import org.jetbrains.annotations.NotNull; @@ -16,7 +17,7 @@ /** * The {@link MapProvider} interface is responsible for managing the available maps. * It will load all maps data from the given path and store them. - * It would not load the map itself over a {@link net.minestom.server.instance.anvil.AnvilLoader} instance. + * It would not load the map itself over a {@link AnvilLoader} instance. * This behavior is handled by another class. * * @author theEvilReaper @@ -26,7 +27,7 @@ public interface MapProvider { /** - * A static fallback position which can be used if no spawn position is set. + * A static fallback position that can be used if no spawn position is set. */ Pos FALLBACK_POS = new Pos(0, 100, 0); @@ -34,14 +35,25 @@ public interface MapProvider { * Saves the given data from a {@link BaseMap} to the given path. * * @param path the path where the map data should be saved - * @param baseMap the map data which should be saved + * @param baseMap the map data that should be saved */ void saveMap(@NotNull Path path, @NotNull BaseMap baseMap); /** * Teleports a {@link Player} to the current active spawn position of the {@link Instance}. + * This method will not set the instance to the current active instance. + * If you want to set the instance to the current active instance, use {@link #teleportToSpawn(Player, boolean)}. * - * @param player the player which should be teleported + * @param player the player that should be teleported + */ + default void teleportToSpawn(@NotNull Player player) { + teleportToSpawn(player, false); + } + + /** + * Teleports a {@link Player} to the current active spawn position of the {@link Instance}. + * + * @param player the player that should be teleported * @param instanceSet if the instance should be set to the current active instance */ void teleportToSpawn(@NotNull Player player, boolean instanceSet); From a075a32518247541a2574b7c69d74bfc6cbfc9c2 Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Tue, 5 May 2026 10:12:20 +0200 Subject: [PATCH 2/3] test(map): update test case --- .../aves/map/provider/MapProviderIntegrationTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/net/theevilreaper/aves/map/provider/MapProviderIntegrationTest.java b/src/test/java/net/theevilreaper/aves/map/provider/MapProviderIntegrationTest.java index 5fc2bc2b..d6cbf097 100644 --- a/src/test/java/net/theevilreaper/aves/map/provider/MapProviderIntegrationTest.java +++ b/src/test/java/net/theevilreaper/aves/map/provider/MapProviderIntegrationTest.java @@ -114,7 +114,7 @@ void testMapHandlingLogic(@NotNull Env env) { assertEquals(Pos.ZERO, player.getPosition()); - mapProvider.teleportToSpawn(player, false); + mapProvider.teleportToSpawn(player); assertNotEquals(Pos.ZERO, player.getPosition()); From c6bfbaa3b92ef7fedfccce57fdc8c2354bdd5c62 Mon Sep 17 00:00:00 2001 From: theEvilReaper Date: Tue, 5 May 2026 10:16:46 +0200 Subject: [PATCH 3/3] docs(map): improve method documentation --- .../net/theevilreaper/aves/map/provider/MapProvider.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java b/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java index 8f0aed06..97a45914 100644 --- a/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java +++ b/src/main/java/net/theevilreaper/aves/map/provider/MapProvider.java @@ -41,10 +41,10 @@ public interface MapProvider { /** * Teleports a {@link Player} to the current active spawn position of the {@link Instance}. - * This method will not set the instance to the current active instance. - * If you want to set the instance to the current active instance, use {@link #teleportToSpawn(Player, boolean)}. + * This method does not change the player's instance. + * To also set the instance, use {@link #teleportToSpawn(Player, boolean)}. * - * @param player the player that should be teleported + * @param player to teleport */ default void teleportToSpawn(@NotNull Player player) { teleportToSpawn(player, false);