mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-12-25 10:07:38 +01:00
#2977: Added availability to set custom permission messages on commands.
This commit is contained in:
parent
6973e099fd
commit
4199b0ca64
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user