Skip to content

Commit 3587883

Browse files
committed
Default ll destination to spawn when last location is disabled
1 parent ee88c9a commit 3587883

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/main/java/org/mvplugins/multiverse/inventories/destination/LastLocationDestinationInstance.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,17 +44,22 @@ public final class LastLocationDestinationInstance extends DestinationInstance<L
4444

4545
var playerWorld = player.getWorld().getName();
4646
if (playerWorld.equals(worldName)) {
47+
// teleporting within same world
4748
return worldManager.getLoadedWorld(worldName).map(MultiverseWorld::getSpawnLocation);
4849
}
4950

5051
for (var group : worldGroupManager.getGroupsForWorld(worldName)) {
5152
Logging.finer("LastLocationDestination: group: " + group);
5253
if (!group.containsWorld(playerWorld) && group.getApplicableShares().contains(Sharables.LAST_LOCATION)) {
54+
// teleporting to a different world group
5355
return Option.of(profileContainerStoreProvider.getStore(ContainerType.GROUP)
5456
.getContainer(group.getName())
5557
.getPlayerProfileNow(player)
5658
.get(Sharables.LAST_LOCATION))
5759
.orElse(() -> worldManager.getLoadedWorld(worldName).map(MultiverseWorld::getSpawnLocation));
60+
} else if (group.getDisabledShares().contains(Sharables.LAST_LOCATION)) {
61+
// last location disabled for the group and hence should not apply, defaulting to world's spawn
62+
return worldManager.getLoadedWorld(worldName).map(MultiverseWorld::getSpawnLocation);
5863
}
5964
}
6065

0 commit comments

Comments
 (0)