Send more helpful message when /lp is executed without any arguments

This commit is contained in:
Luck 2017-12-17 13:31:45 +00:00
parent fb5925e1e8
commit f71237ea95
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 10 additions and 2 deletions

View File

@ -143,8 +143,13 @@ public class CommandManager {
handleRewrites(arguments, true);
// Handle no arguments
if (arguments.size() == 0) {
sendCommandUsage(sender, label);
if (arguments.size() == 0 || (arguments.size() == 1 && arguments.get(0).trim().isEmpty())) {
CommandUtils.sendPluginMessage(sender, "&2Running &bLuckPerms v" + plugin.getVersion() + "&2.");
if (mainCommands.stream().anyMatch(c -> c.shouldDisplay() && c.isAuthorized(sender))) {
Message.VIEW_AVAILABLE_COMMANDS_PROMPT.send(sender, label);
} else {
Message.NO_PERMISSION_FOR_SUBCOMMANDS.send(sender);
}
return CommandResult.INVALID_ARGS;
}

View File

@ -45,6 +45,9 @@ public enum Message {
*/
PREFIX("&7&l[&b&lL&3&lP&7&l] ", false),
VIEW_AVAILABLE_COMMANDS_PROMPT("&3Use &a/{} help &3to view available commands.", true),
NO_PERMISSION_FOR_SUBCOMMANDS("&3You do not have permission to use any sub commands.", true),
EMPTY("&c{}", true),
PLAYER_ONLINE("&aOnline", false),
PLAYER_OFFLINE("&cOffline", false),