HelpChat/ChatChat

user-offline message is only used when receiver is vanished for sender.

BlitzOffline opened this issue · 1 comments

Currently the invalid-argument message is being send if the receiver is a ChatUser and that user is offline. We should be sending the user-offline message instead.

EDIT: We might want to register the ChatUser as a parameter with our own validator and stuff since right now I'm pretty sure triumph-cmds uses the SenderMapper we register when creating the BukkitCommandManager.

OK so I was really blind, and also this is really stupid but we register the argument in the registerCommands method.

commandManager.registerArgument(ChatUser.class, (sender, arg) -> {
final var player = Bukkit.getPlayer(arg);
if (player == null) {
return null;
}
return usersHolder.getUser(player);
});

Anyways we need to add extra checks here. First of all, if player == null, we need to send the offline-player message instead.