Skip to content

Commit 933d8a4

Browse files
authored
Merge pull request #661 from Multiverse/fix/handle-disabled-share
Fix handling of disabled shares with ll destination and share handling
2 parents ee88c9a + d1552e7 commit 933d8a4

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

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

src/main/java/org/mvplugins/multiverse/inventories/handleshare/ReadOnlyShareHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ protected void prepareProfiles() {
2323
for (WorldGroup worldGroup : worldGroups) {
2424
affectedProfiles.addReadProfile(worldGroup.getGroupProfileContainer().getProfileKey(player), worldGroup.getApplicableShares());
2525
unhandledShares.removeAll(worldGroup.getApplicableShares());
26+
unhandledShares.removeAll(worldGroup.getDisabledShares());
2627
}
2728
if (!unhandledShares.isEmpty()) {
2829
affectedProfiles.addReadProfile(

src/main/java/org/mvplugins/multiverse/inventories/handleshare/WriteOnlyShareHandler.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ protected void prepareProfiles() {
3838
worldGroup.getApplicableShares()
3939
);
4040
unhandledShares.removeAll(worldGroup.getApplicableShares());
41+
unhandledShares.removeAll(worldGroup.getDisabledShares());
4142
}
4243
Shares sharesToWrite = inventoriesConfig.getAlwaysWriteWorldProfile()
4344
? Sharables.enabled()

0 commit comments

Comments
 (0)