Skip to content

Commit f181bb7

Browse files
committed
Better error message for teleport command when no players match selectors.
1 parent 7207d93 commit f181bb7

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

src/main/java/org/mvplugins/multiverse/core/command/MVCommandContexts.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,12 @@ private IssuerAwareContextBuilder<Player[]> playerArrayContextBuilder() {
278278
})
279279
.issuerOnlyFailMessage((context) -> Message.of("This command can only be used by a player."))
280280
.issuerAwareInputFailMessage((context, input) -> Message.of("Invalid player: " + input + ". Either specify an online player or use this command as a player."))
281-
.inputOnlyFailMessage((context, input) -> Message.of("Player " + input + " not found."));
281+
.inputOnlyFailMessage((context, input) -> {
282+
if (PlayerFinder.isSelector(input)) {
283+
return Message.of("No player(s) matched selector: " + input + ".");
284+
}
285+
return Message.of("Player(s) " + input + " not found.");
286+
});
282287
}
283288

284289
private PlayerLocation parsePlayerLocation(BukkitCommandExecutionContext context) {

src/main/java/org/mvplugins/multiverse/core/commands/TeleportCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ final class TeleportCommand extends CoreCommand {
6464
void onTeleportCommand(
6565
MVCommandIssuer issuer,
6666

67-
@co.aikar.commands.annotation.Flags("resolve=issuerAware")
67+
@co.aikar.commands.annotation.Flags("resolve=issuerAware,maxArgForAware=1")
6868
@Syntax("[player]")
6969
@Description("{@@mv-core.teleport.player.description}")
7070
PlayerArrayValue playersValue,

0 commit comments

Comments
 (0)