CommandName vs CommandLabel

Discussion in 'Plugin Development' started by Sabersamus, Aug 15, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Sabersamus

    So, I know I'm not that experience in Bukkit, or Java.. But I see a lot of people using commandLabel instead of commandName. Although yes it works, here is an advantage of using commandName;

    Code:java
    1.  
    2. public boolean onCommand(CommandSender cs, Command cmd, String label, String[] args){
    3. if(cmd.getName().equalsIgnoreCase("YourCommandHere")){
    4.  
    5. }
    6.  


    using commandLabel, its going to look only for the label you put in, so if your command has multiple aliases you'll have to check to see if the label is any of them.

    using command name it automatically finds all the aliases, and if any match the input it fires off that CommandExecutor

    thank you :3
     
    4thegame3 likes this.
Thread Status:
Not open for further replies.

Share This Page