diff --git a/src/main/java/org/mvplugins/multiverse/core/destination/core/ExactDestination.java b/src/main/java/org/mvplugins/multiverse/core/destination/core/ExactDestination.java index ab76a9ef..d62f3dfd 100644 --- a/src/main/java/org/mvplugins/multiverse/core/destination/core/ExactDestination.java +++ b/src/main/java/org/mvplugins/multiverse/core/destination/core/ExactDestination.java @@ -36,6 +36,16 @@ public class ExactDestination implements Destination getLocation(@NotNull Entity teleportee) { + // todo: maybe check if the world is null? return Option.of(location); } diff --git a/src/test/java/org/mvplugins/multiverse/core/destination/DestinationTest.kt b/src/test/java/org/mvplugins/multiverse/core/destination/DestinationTest.kt index 20ba04cd..b260ab04 100644 --- a/src/test/java/org/mvplugins/multiverse/core/destination/DestinationTest.kt +++ b/src/test/java/org/mvplugins/multiverse/core/destination/DestinationTest.kt @@ -69,6 +69,17 @@ class DestinationTest : TestWithMockBukkit() { assertEquals("e:world:1.2,2.0,3.0:10.5:9.5", destination.toString()) } + @Test + fun `Exact destination instance from location`() { + val exactDestination = serviceLocator.getActiveService(ExactDestination::class.java).takeIf { it != null } ?: run { + throw IllegalStateException("ExactDestination is not available as a service") } + + val location = Location(world.bukkitWorld.orNull, 1.2, 2.0, 3.0, 9.5F, 10.5F) + val destination = exactDestination.fromLocation(location) + assertEquals(location, destination.getLocation(player).orNull) + assertEquals("e:world:1.2,2.0,3.0:10.5:9.5", destination.toString()) + } + @Test fun `Player destination instance`() { assertTrue(destinationsProvider.getDestinationById("pl") is PlayerDestination)