improvements: Message for visit Command to a players without plots (#1796)

We provide now a clear message if we are sure that the Visit command means a player but we dont found any claimed plots for this player.

This is helpful if we try teleport to  a numeric named player

See this related tickets: #1691, #1778
This commit is contained in:
Christian Langel 2017-12-09 11:08:15 +01:00 committed by Alexander Söderberg
parent 6c06e48a1f
commit 59557cf889
2 changed files with 18 additions and 9 deletions

View File

@ -89,12 +89,21 @@ public class Visit extends Command {
return; return;
} }
// we found nothing we now check for a combined command arg if(unsorted == null || unsorted.isEmpty()) {
if((args[0].contains(";") || args[0].contains(",")) && (unsorted == null || unsorted.isEmpty())) { // we now check for a combined command arg
if(args[0].contains(";") || args[0].contains(",")) {
Plot plot = MainUtil.getPlotFromString(player, args[0], true); Plot plot = MainUtil.getPlotFromString(player, args[0], true);
if (plot != null) { if (plot != null) {
unsorted = Collections.singletonList(plot.getBasePlot(false)); unsorted = Collections.singletonList(plot.getBasePlot(false));
} }
} else { // its not a combined command check for player search without result
UUID user = UUIDHandler.getUUIDFromString(args[0]);
if(user != null) {
// we know safe its a player (we can provide a specific message that we searched for player plots without result)
MainUtil.sendMessage(player, C.FOUND_NO_PLOTS_FOR_PLAYER, UUIDHandler.getName(user));
return;
}
}
} }
break; break;
@ -224,7 +233,6 @@ public class Visit extends Command {
} }
} catch (Exception ignored) { } catch (Exception ignored) {
page = PAGE_OUT_OF_RANGE; page = PAGE_OUT_OF_RANGE;
C.NOT_VALID_NUMBER.send(player, "(1, ∞)");
} }
return page; return page;

View File

@ -541,6 +541,7 @@ public enum C {
NO_SUCH_PLOT("$2There is no such plot", "Invalid"), NO_SUCH_PLOT("$2There is no such plot", "Invalid"),
PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"), PLAYER_HAS_NOT_BEEN_ON("$2That player hasn't been in the plotworld", "Invalid"),
FOUND_NO_PLOTS("$2Found no plots with your search query", "Invalid"), FOUND_NO_PLOTS("$2Found no plots with your search query", "Invalid"),
FOUND_NO_PLOTS_FOR_PLAYER("$2No plots found for player: %s", "Invalid"),
/* /*
* Camera * Camera
*/ */