Resource (ACF - BETA) Annotation Command Framework

Discussion in 'Spigot Plugin Development' started by Aikar, Apr 19, 2017.

  1. A bug was fixed last night if you use multiple command classes that resolve to the same slash command, for resolving @Default - pull an update!
     
  2. another bug was fixed with 2+ classes using same root command today, update :)
     
  3. WAS

    WAS

    I really want to use this framework for WeChat. Currently I just have my master command class. Which is just a huge mess of switches and sub-switches. I'm just being so lazy about porting the almost 2k file to ACF.
     
  4. Yeah sounds like the perfect cleanup to use ACF :)
     
  5. Wow! I'll look into this across my plugins, so we don't even need to register across plugin.yml?
     
  6. electronicboy

    IRC Staff

    No need to register commands in your plugin.yml, ACF skips system that requires commands to be registered in there by placing itself directly into the command map (That way, it can do all the magic it does)
     
    • Informative Informative x 1
  7. Wow holy crap, thanks for clarifying :p

    Ima have to use this system, would I be required to shade it with maven?
     
  8. MiniDigger

    Supporter

  9. Oh sweet cheers dude! Thanks very much.

    Looks like my evening will be spent migrating my commands, right now I use the CommandHandler / Interface method and I'm not too happy with it.

    I also feel like I can't be bothered to setup more handlers to do multiple commands, I'm happy with this I can create commands and sub commands very easily.
     
  10. MiniDigger

    Supporter

    if you have any problems, be sure to just direct them into this thread or into #aikar on the spigot irc. I am sure aikar is also happy about every bit of feedback and suggestions he can get ;)
     
    • Friendly Friendly x 1
  11. Ayeee sweet dude, thanks for the help and friendlyness :p I actually cannot wait to use this later, will make my life so much easier :D Especially as there is a feature I wish to add to one of my plugins and I sort of doubted doing it as I couldn't easily add a custom root command.

    Now I can say I can do it! :D
     
  12. Just looked into using this, how could I send the player a message if they don't have the @CommandPermission("") ?
     
  13. MiniDigger

    Supporter

    you don't magic acf does that for you ;)
     
  14. I wanna send them a custom 1 ;-; xD

    Is it possible to have 2 base commands? I wanna add an extra root command :p

    I have
    Code (Text):
    @CommandAlias("unitygen|gen")
    public class MainCommand extends BaseCommand {

    }
    so far
     
  15. electronicboy

    IRC Staff

    you can have as many BaseCommand's as you want, custom no permission messages wouldn't be too hard to add, no idea if that would be better waiting for Aikars i18n support, but shouldn't be something that is even remotely hard to add
     
  16. Oh I didn't know, could you give an example registering 2 base commands, and then using them? I take it I would use the annotations above then use the same annotations but with the sub command too?
     
  17. Eek didn't work ;-;

    Code (Text):
    @CommandAlias("unitygen|gen")
    @Subcommand("reload|r")
    public class ReloadCommand extends BaseSubCommand {

        public void onReload(CommandSender sender) {
            if(sender.hasPermission("unitygen.reload")){
                sender.sendMessage(Lang.RELOAD.get());

                Main.getInstance().reloadConfig();
                Main.getFileManager().loadFiles();
            }else sender.sendMessage(Lang.NO_PERMISSION.get());
        }
     
     
  18. Mother freaking outstanding resource.
    I don't know how to describe my word rn, this is one of the most quality resource I haven't seen for a while.
    You deserve a medal, my friend
     
    • Like Like x 1
  19. Move the @Subcommand down to the onReload method.
     
    • Like Like x 1

Share This Page