mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-24 22:26:45 +01:00
Error message for '/p v' when page out of range
This commit is contained in:
parent
8a77d5a450
commit
a83a79c17e
@ -80,11 +80,6 @@ public class Visit extends Command {
|
||||
// then we get it another time further on
|
||||
final List<Plot> unsorted = query.asList();
|
||||
|
||||
if (unsorted.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (unsorted.size() > 1) {
|
||||
query.whereBasePlot();
|
||||
}
|
||||
@ -93,12 +88,6 @@ public class Visit extends Command {
|
||||
page = 1;
|
||||
}
|
||||
|
||||
if (page < 1 || page > unsorted.size()) {
|
||||
// TODO: Huh?
|
||||
// MainUtil.sendMessage(player, String.format("(1, %d)", unsorted.size()));
|
||||
return;
|
||||
}
|
||||
|
||||
PlotArea relativeArea = sortByArea;
|
||||
if (Settings.Teleport.PER_WORLD_VISIT && sortByArea == null) {
|
||||
relativeArea = player.getApplicablePlotArea();
|
||||
@ -112,6 +101,18 @@ public class Visit extends Command {
|
||||
|
||||
final List<Plot> plots = query.asList();
|
||||
|
||||
if (plots.isEmpty()) {
|
||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
||||
return;
|
||||
} else if (plots.size() < page || page < 1) {
|
||||
player.sendMessage(
|
||||
TranslatableCaption.of("invalid.number_not_in_range"),
|
||||
Template.of("min", "1"),
|
||||
Template.of("max", String.valueOf(plots.size()))
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
final Plot plot = plots.get(page - 1);
|
||||
if (!plot.hasOwner()) {
|
||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_UNOWNED)) {
|
||||
|
Loading…
Reference in New Issue
Block a user