Skip to content

Commit 698a48c

Browse files
committed
tip about checking previous names if no player found
1 parent 0eb88ff commit 698a48c

File tree

4 files changed

+7
-3
lines changed

4 files changed

+7
-3
lines changed

src/main/java/vc/commands/NamesCommand.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import vc.api.model.LabyProfileSearchResponse;
1212
import vc.openapi.handler.ApiException;
1313
import vc.util.DiscordMarkdownEscape;
14+
import vc.util.Validator;
1415

1516
import java.net.http.HttpTimeoutException;
1617

@@ -36,6 +37,9 @@ public Mono<Message> handle(final ChatInputInteractionEvent event) {
3637
if (player == null) {
3738
return error(event, "`player` option is required");
3839
}
40+
if (!Validator.isValidPlayerName(player)) {
41+
return error(event, "Invalid player name");
42+
}
3943
LabyProfileSearchResponse searchResponse;
4044
try {
4145
searchResponse = labyRestClient.searchProfiles(player);

src/main/java/vc/commands/WatchCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ private ChatInteractionOptionContext resolveProfileSubOption(final ChatInteracti
346346
}
347347
Optional<ProfileData> playerIdentity = playerLookup.getPlayerIdentity(playerName);
348348
if (playerIdentity.isEmpty()) {
349-
ctx.setError("No player named `%s` exists".formatted(playerName));
349+
ctx.setError("No player named `%s` exists\nCheck for previous accounts with `/names`".formatted(playerName));
350350
return ctx;
351351
}
352352
ctx.profileData = playerIdentity.get();

src/main/java/vc/commands/WatchGuildCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ private ChatInteractionOptionContext resolveProfileSubOption(final ChatInteracti
462462
}
463463
Optional<ProfileData> playerIdentity = playerLookup.getPlayerIdentity(playerName);
464464
if (playerIdentity.isEmpty()) {
465-
ctx.setError("No player named `%s` exists".formatted(playerName));
465+
ctx.setError("No player named `%s` exists\nCheck for previous accounts with `/names`".formatted(playerName));
466466
return ctx;
467467
}
468468
ctx.profileData = playerIdentity.get();

src/main/java/vc/commands/options/PlayerLookupOption.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public void apply(final ChatInteractionOptionContext context) {
3333
}
3434
Optional<ProfileData> playerIdentity = playerLookup.getPlayerIdentity(playerName);
3535
if (playerIdentity.isEmpty()) {
36-
context.setError("No player named `" + playerName + "` exists");
36+
context.setError("No player named `" + playerName + "` exists\nCheck for previous accounts with `/names`");
3737
return;
3838
}
3939
context.profileData = playerIdentity.get();

0 commit comments

Comments
 (0)