mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 12:25:46 +01:00
Reimplement per-world-visit
This commit is contained in:
parent
932873ba02
commit
74a9c2f6b4
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
@ -119,7 +120,7 @@ public class HomeCommand extends Command {
|
||||
Captions.NOT_A_NUMBER.send(player, identifier);
|
||||
return CompletableFuture.completedFuture(false);
|
||||
}
|
||||
query.withSortingStrategy(SortingStrategy.SORT_BY_TEMP);
|
||||
sortBySettings(query, player);
|
||||
break;
|
||||
}
|
||||
// either plot id or alias
|
||||
@ -178,7 +179,7 @@ public class HomeCommand extends Command {
|
||||
query.withPlot(plot);
|
||||
break;
|
||||
case 0:
|
||||
query.withSortingStrategy(SortingStrategy.SORT_BY_TEMP);
|
||||
sortBySettings(query, player);
|
||||
break;
|
||||
}
|
||||
if (basePlotOnly) {
|
||||
@ -188,6 +189,15 @@ public class HomeCommand extends Command {
|
||||
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
|
||||
public Collection<Command> tab(PlotPlayer player, String[] args, boolean space) {
|
||||
final List<Command> completions = new ArrayList<>();
|
||||
|
@ -27,6 +27,7 @@ package com.plotsquared.core.command;
|
||||
|
||||
import com.plotsquared.core.PlotSquared;
|
||||
import com.plotsquared.core.configuration.Captions;
|
||||
import com.plotsquared.core.configuration.Settings;
|
||||
import com.plotsquared.core.events.TeleportCause;
|
||||
import com.plotsquared.core.player.PlotPlayer;
|
||||
import com.plotsquared.core.plot.Plot;
|
||||
@ -93,8 +94,13 @@ public class Visit extends Command {
|
||||
return;
|
||||
}
|
||||
|
||||
if (sortByArea != null) {
|
||||
query.relativeToArea(sortByArea).withSortingStrategy(SortingStrategy.SORT_BY_CREATION);
|
||||
PlotArea relativeArea = sortByArea;
|
||||
if (Settings.Teleport.PER_WORLD_VISIT && sortByArea == null) {
|
||||
relativeArea = player.getApplicablePlotArea();
|
||||
}
|
||||
|
||||
if (relativeArea != null) {
|
||||
query.relativeToArea(relativeArea).withSortingStrategy(SortingStrategy.SORT_BY_CREATION);
|
||||
} else {
|
||||
query.withSortingStrategy(SortingStrategy.SORT_BY_TEMP);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user