From 59557cf8898755a334aec36a43ccc7a2bf340652 Mon Sep 17 00:00:00 2001 From: Christian Langel Date: Sat, 9 Dec 2017 11:08:15 +0100 Subject: [PATCH] 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 --- .../plot/commands/Visit.java | 26 ++++++++++++------- .../intellectualcrafters/plot/config/C.java | 1 + 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java index 77467c98b..36538f6b6 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Visit.java @@ -88,14 +88,23 @@ public class Visit extends Command { C.COMMAND_SYNTAX.send(player, getUsage()); return; } - - // we found nothing we now check for a combined command arg - if((args[0].contains(";") || args[0].contains(",")) && (unsorted == null || unsorted.isEmpty())) { - Plot plot = MainUtil.getPlotFromString(player, args[0], true); - if (plot != null) { - unsorted = Collections.singletonList(plot.getBasePlot(false)); - } - } + + if(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); + if (plot != null) { + 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; case 0: @@ -224,7 +233,6 @@ public class Visit extends Command { } } catch (Exception ignored) { page = PAGE_OUT_OF_RANGE; - C.NOT_VALID_NUMBER.send(player, "(1, ∞)"); } return page; diff --git a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java index 8658cfd10..e7d84ff5e 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/config/C.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/config/C.java @@ -541,6 +541,7 @@ public enum C { NO_SUCH_PLOT("$2There is no such plot", "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_FOR_PLAYER("$2No plots found for player: %s", "Invalid"), /* * Camera */