Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
import com.plotsquared.core.inject.factory.ProgressSubscriberFactory;
import com.plotsquared.core.location.Direction;
import com.plotsquared.core.location.Location;
import com.plotsquared.core.player.MetaDataAccess;
import com.plotsquared.core.player.PlayerMetaDataKeys;
import com.plotsquared.core.player.PlotPlayer;
import com.plotsquared.core.plot.flag.PlotFlag;
import com.plotsquared.core.queue.QueueCoordinator;
Expand Down Expand Up @@ -380,6 +382,22 @@ public boolean unlinkPlot(final boolean createRoad, final boolean createSign, fi
boolean[] merged = new boolean[]{false, false, false, false};
current.setMerged(merged);
}
// Update TEMPORARY_LAST_PLOT metadata for all players that were in the merged plot
// so that getCurrentPlot() returns the correct individual plot based on their location
for (PlotPlayer<?> player : PlotSquared.platform().playerManager().getPlayers()) {
try (MetaDataAccess<Plot> lastPlotAccess = player.accessTemporaryMetaData(PlayerMetaDataKeys.TEMPORARY_LAST_PLOT)) {
Plot lastPlot = lastPlotAccess.get().orElse(null);
if (lastPlot != null && plots.contains(lastPlot)) {
// Player was in the merged plot, update to their actual current plot
Plot actualPlot = player.getLocation().getPlot();
if (actualPlot != null) {
lastPlotAccess.set(actualPlot);
} else {
lastPlotAccess.remove();
}
}
}
}
if (createSign) {
queue.setCompleteTask(() -> TaskManager.runTaskAsync(() -> {
List<CompletableFuture<Void>> tasks = plots.stream().map(current -> PlotSquared.platform().playerManager()
Expand Down
Loading