How to add command aliases to a command?

Discussion in 'Plugin Development' started by StevenMG, May 11, 2013.

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

    StevenMG

    I have been trying to add a section in my config file where you will be able to put aliases for a command. I have used this code:
    Code:
    getCommand("cc").setAliases(mainConfig.getConfig().getStringList("ccAliases"));
    That does not do anything though, and the command is still not registered. I do know that the code I am using to get stuff from the config is working so do not say that it is returning null.

    I can go into the bukkit.yml file and set aliases that way, but I do not want to require server admins to do this themselves. I know there are some admins that know what they are doing, and for them it would be no problem, but there are too many that are inexperienced for that to work well.
     
  2. Offline

    rylinaux

    You can include aliases for commands in your plugin.yml as well:
    Code:
    commands:
      longcommand:
        aliases: lc
     
  3. Offline

    gomeow

    rylinaux
    Its an array, so that'd error.
    Code:
    commands:
      longcommand:
        aliases: [lc, longc, lcommand]
     
  4. Offline

    rylinaux

  5. Offline

    ZeusAllMighty11

    The command doesn't work because you didn't set an executor for it
     
Thread Status:
Not open for further replies.

Share This Page