#2977: Added availability to set custom permission messages on commands.

This commit is contained in:
mciolkosz 2020-10-17 18:12:01 +11:00 committed by md_5
parent 6973e099fd
commit 4199b0ca64
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
2 changed files with 5 additions and 1 deletions

View File

@ -4,6 +4,7 @@ import com.google.common.base.Preconditions;
import lombok.AccessLevel;
import lombok.Data;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
import net.md_5.bungee.api.CommandSender;
/**
@ -17,6 +18,8 @@ public abstract class Command
private final String name;
private final String permission;
private final String[] aliases;
@Setter(AccessLevel.PROTECTED)
private String permissionMessage;
/**
* Construct a new command with no permissions or aliases.
@ -42,6 +45,7 @@ public abstract class Command
this.name = name;
this.permission = permission;
this.aliases = aliases;
this.permissionMessage = null;
}
/**

View File

@ -172,7 +172,7 @@ public final class PluginManager
{
if ( tabResults == null )
{
sender.sendMessage( proxy.getTranslation( "no_permission" ) );
sender.sendMessage( ( command.getPermissionMessage() == null ) ? proxy.getTranslation( "no_permission" ) : command.getPermissionMessage() );
}
return true;
}