Skip to content

Commit

Permalink
🎨 improve messages
Browse files Browse the repository at this point in the history
  • Loading branch information
SerenModz21 committed Jul 7, 2022
1 parent 272a4cc commit 0cd9225
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/main/java/me/seren/discord/Listener.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,19 @@ public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent even
String playerName = event.getOptions().get(0).getAsString();
String content = event.getOptions().get(1).getAsString();
ServerPlayerEntity player = this.client.server.getPlayerManager().getPlayer(playerName);

if (player == null) {
event.reply("Player not found").setEphemeral(true).queue();
event.reply("No players were found with the name \"" + playerName + "\"")
.setEphemeral(true).queue();
return;
}

if (player.isDisconnected()) {
event.reply(player.getEntityName() + " is not currently online")
.setEphemeral(true).queue();
return;
}

player.sendChatMessage(
SignedMessage.of(Text.of(content)),
MessageSender.of(Text.of(event.getUser().getAsTag())),
Expand Down

0 comments on commit 0cd9225

Please sign in to comment.