Allow players to /plot home from non-plot-areas if per-world-teleport is enabled

This commit is contained in:
dordsor21 2021-08-08 12:36:08 +01:00
parent 5ab8d50b86
commit dd36036334
No known key found for this signature in database
GPG Key ID: 1E53E88969FFCF0B

View File

@ -212,8 +212,10 @@ public class HomeCommand extends Command {
}
private void sortBySettings(PlotQuery plotQuery, PlotPlayer<?> player) {
if (Settings.Teleport.PER_WORLD_VISIT) {
plotQuery.relativeToArea(player.getApplicablePlotArea())
// Player may not be in a plot world when attempting to get to a plot home
PlotArea area = player.getApplicablePlotArea();
if (Settings.Teleport.PER_WORLD_VISIT && area != null) {
plotQuery.relativeToArea(area)
.withSortingStrategy(SortingStrategy.SORT_BY_CREATION);
} else {
plotQuery.withSortingStrategy(SortingStrategy.SORT_BY_TEMP);