mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-21 11:45:19 +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
|
// then we get it another time further on
|
||||||
final List<Plot> unsorted = query.asList();
|
final List<Plot> unsorted = query.asList();
|
||||||
|
|
||||||
if (unsorted.isEmpty()) {
|
|
||||||
player.sendMessage(TranslatableCaption.of("invalid.found_no_plots"));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (unsorted.size() > 1) {
|
if (unsorted.size() > 1) {
|
||||||
query.whereBasePlot();
|
query.whereBasePlot();
|
||||||
}
|
}
|
||||||
@ -93,12 +88,6 @@ public class Visit extends Command {
|
|||||||
page = 1;
|
page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page < 1 || page > unsorted.size()) {
|
|
||||||
// TODO: Huh?
|
|
||||||
// MainUtil.sendMessage(player, String.format("(1, %d)", unsorted.size()));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PlotArea relativeArea = sortByArea;
|
PlotArea relativeArea = sortByArea;
|
||||||
if (Settings.Teleport.PER_WORLD_VISIT && sortByArea == null) {
|
if (Settings.Teleport.PER_WORLD_VISIT && sortByArea == null) {
|
||||||
relativeArea = player.getApplicablePlotArea();
|
relativeArea = player.getApplicablePlotArea();
|
||||||
@ -112,6 +101,18 @@ public class Visit extends Command {
|
|||||||
|
|
||||||
final List<Plot> plots = query.asList();
|
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);
|
final Plot plot = plots.get(page - 1);
|
||||||
if (!plot.hasOwner()) {
|
if (!plot.hasOwner()) {
|
||||||
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_UNOWNED)) {
|
if (!Permissions.hasPermission(player, Permission.PERMISSION_VISIT_UNOWNED)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user