Resource (ACF - BETA) Annotation Command Framework

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

  1. Also, once the API is unlocked, YAML based loading can be added to the Bukkit manager, or even Property files still.

    This means you'll be able to let your users manage the language strings too.

    Figuring out that kind of stuff is why I haven't opened up the API yet.
    right now I only have the Locales class, but I'm pretty sure I need to expand this to BukkitLocales, SpongeLocales and BungeeLocales too.

    EDIT: 1/6/2018 - The work discussed here has been implemented!
    #141 Aikar, Jul 4, 2017
    Last edited: Jan 6, 2018
  2. No, not really, but i want the users to be able to change the messages by them self and i don't really know how to do that unless i make "copy" of the language files and then load the messages from them because ACF can only find the language files if they are in the jar, right?
  3. Currently yes, but give me a bit more time, as i said in my last post, and this will be supported.

    But highly recommended to ship a "Template" file, and only load custom messages if the end user wants to change them....

    That way itll keep the defaults unless the user wants to change them.

    Maybe have every line commented out
  4. Sorry, i did not see your last message before i posted but yes that would work.
  5. FYI, Command Cooldown support is a planned feature! I'm going to design an API that allows you to build "Feature Packs" for ACF, so you can have even more published libraries that extend into ACF, and cooldowns will be one.
    These won't be included in core api, so they won't bloat people who don't want to use them.
    • Like Like x 1
    • Creative Creative x 1
  6. I'm using this in my coming soon premium plugin. Any documentation for how to use the locales system, so I can change the usage messages? Or is it still WIP? Also, how does the tab completion system work?

    Thanks for making this so flexible. I can't go back to normal commands now xD.
  7. see:
    for current level of support.

    You can change the messages for your plugin, but it's not to the point that you can let your end users customize the messages.

    Also colors are still not open but im hoping to work on the locales api tomorrow and try to get at least some things opened up.

    but until i finalize the API, the API is locked, but it will automatically load the english language file out of the jar for now so it should be good enough to let you change wording.

    And tab completion has its own annotation as shown in the examples

    you register @ codes for custom populators or provide hard coded list of words.

    Just feel free to tinker, then ask questions to a specific need if you get stuck.

    Also, the wiki on github is open to edit, so if you find something that you find out that confused you, feel free to add a FAQ entry or clarify on existing pages.

    EDIT: 1/6/2018 - The work discussed here has been implemented!
    #148 Aikar, Jul 15, 2017
    Last edited: Jan 6, 2018
    • Like Like x 1
    • Winner Winner x 1
  8. Can I just include the section symbol in the file for now?

    Also, will we be able to override messages programmatically?

    Thanks for the quick response.
  9. public void sendMessage(CommandIssuer issuerArg, MessageType type, MessageKey key, String... replacements) {}

    You could create a custom command manager by extending BukkitCommandManager and then override this method.

    But yes section symbols should work fine long as you don't send it to a different non bukkit platform that doesn't understand them :p but doesn't sound like you are.
    #150 Aikar, Jul 15, 2017
    Last edited: Jul 21, 2017
    • Useful Useful x 1
  10. Bump! Forgot to post this, but the Locales / I18N API was added.
    I will get documentation up ASAP,but you may access it from manager.getLocales() and add/change keys programmatically..

    The bukkit manager also includes API's for loading messages from FileConfiguration objects and Yaml Files.

    You may define a YAML file in your plugin data folder like so:

    Code (YAML):

    : "<language here">
    : "Perm denied message here"
    using the keys found here:

    And override as you see fit. Please only override ones you ultimately want to change, incase we ever improve the default language.

    You will need to load a file per language you want to support.

    use .getLocales().setDefaultLocale() to change the default if you load language entries for other languages.
    ACF will eventually provide other languages once someone translates the files for us.
  11. MiniDigger


    your wish is my command :D
    Translated the files to german. Any german speaker here is welcome to check and discuss:
    • Like Like x 1
  12. I did not realize the power of this until I used it.

    This resource is absolutely amazing. It feels like magic at some points and it is so simple to use.

    Thank you so much for making this. This has sped up my development so much and let to more updatable, readable, and error free plugins. I encourage everyone to use it and don’t let anything about it intimidate you. Once you use it yourself it is very easy to use.
    #154 Synapz, Jul 28, 2017
    Last edited: Jul 28, 2017
    • Agree Agree x 3
  13. Just FYI - Mojangs coming out with some crazy command stuff in 1.13. It is planned that ACF will integrate with this, so if you use ACF, you will automatically get all of the new 1.13 client features once we get support in, and you wont have to worry about integrating mojangs api.
    • Like Like x 1
    • Informative Informative x 1
    • Useful Useful x 1
  14. To add upon this, for anyone who hasn't seen the upcoming changes, here is a quick link to Dinnerbone's tweet.
  15. oh my god there has been a lot of progression on ACF
    i love it
    cant wait to use the framework again \o/
    • Agree Agree x 1
  16. Why'd you stop =P
  17. I was inactive in development before I went "inactive" :p
    I'll try to get into it again soon, though.