Merge branch 'v5' into v6

This commit is contained in:
NotMyFault 2021-04-03 22:31:54 +02:00
commit 496fe09f78
No known key found for this signature in database
GPG Key ID: 158F5701A6AAD00C
3 changed files with 19 additions and 5 deletions

View File

@ -140,7 +140,7 @@ public class HomeCommand extends Command {
); );
return CompletableFuture.completedFuture(false); return CompletableFuture.completedFuture(false);
} }
query.withSortingStrategy(SortingStrategy.SORT_BY_TEMP); sortBySettings(query, player);
break; break;
} }
// either plot id or alias // either plot id or alias
@ -202,7 +202,7 @@ public class HomeCommand extends Command {
query.withPlot(plot); query.withPlot(plot);
break; break;
case 0: case 0:
query.withSortingStrategy(SortingStrategy.SORT_BY_TEMP); sortBySettings(query, player);
break; break;
} }
if (basePlotOnly) { if (basePlotOnly) {
@ -212,6 +212,15 @@ public class HomeCommand extends Command {
return CompletableFuture.completedFuture(true); return CompletableFuture.completedFuture(true);
} }
private void sortBySettings(PlotQuery plotQuery, PlotPlayer<?> player) {
if (Settings.Teleport.PER_WORLD_VISIT) {
plotQuery.relativeToArea(player.getApplicablePlotArea())
.withSortingStrategy(SortingStrategy.SORT_BY_CREATION);
} else {
plotQuery.withSortingStrategy(SortingStrategy.SORT_BY_TEMP);
}
}
@Override @Override
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) { public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
final List<Command> completions = new ArrayList<>(); final List<Command> completions = new ArrayList<>();

View File

@ -98,8 +98,13 @@ public class Visit extends Command {
return; return;
} }
if (sortByArea != null) { PlotArea relativeArea = sortByArea;
query.relativeToArea(sortByArea).withSortingStrategy(SortingStrategy.SORT_BY_CREATION); if (Settings.Teleport.PER_WORLD_VISIT && sortByArea == null) {
relativeArea = player.getApplicablePlotArea();
}
if (relativeArea != null) {
query.relativeToArea(relativeArea).withSortingStrategy(SortingStrategy.SORT_BY_CREATION);
} else { } else {
query.withSortingStrategy(SortingStrategy.SORT_BY_TEMP); query.withSortingStrategy(SortingStrategy.SORT_BY_TEMP);
} }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists