Resource commodore - utility for using Minecraft's 1.13 'brigadier' library in Bukkit plugins

Discussion in 'Spigot Plugin Development' started by Luck, Jul 19, 2018.

  1. I was keen to start using the new 1.13 command tab completion stuff in my plugins, so I made this small API to make it easy to register argument data with the server.

    It allows you to do stuff like this:

    [​IMG]
    [​IMG]

    Hopefully at some point, a nicer API will be introduced into Bukkit to allow this data to be easily registered. At the moment though, the only way to do it is with reflection to access CraftBukkit & NMS internals. commodore just provides a nice wrapper around this.

    The code and usage instructions are all on GitHub.

    https://github.com/lucko/commodore

    Enjoy. :)
     
    • Useful Useful x 13
    • Like Like x 11
    • Winner Winner x 8
  2. ScarabCoder

    ScarabCoder Retired Resource Staff
    Retired

    Would love to see stuff like this PRd into Bukkit at some point. Unfortunately, considering it doesn't really have a command structure feature (like Aikar's) we probably won't be seeing it.

    Anyway, good work, looks pretty cool!
     
    • Agree Agree x 1
  3. Omg this is dope, ty! I was asking md_5 about this before :p
     
  4. The difficulty is that the brigadier library that powers the whole system isn't released under an open source license - it can't be included in Bukkit. Interface wrapper classes for brigadier would have to be created in Bukkit for such functionality to be possible.

    However, although brigadier is not released under an 'open source license', it is indeed 'open source'. The source code is available from Mojang's library repo, and it isn't obfuscated in the Minecraft jar file. (the same is true about com.mojang.authlib)

    tl;dr is: you can use the brigadier classes in your plugin via commodore, but they can't be included in Bukkit for licensing reasons.
     
    • Like Like x 1
  5. I like the idea, actually I tried this and it works pretty well.

    With a few modifications, and some parser classes added, I was able to use the nms argument types to autocomplete playernames, locations, etc.
    Currently I'm searching for a way to create and register custom argument types.
     
    • Like Like x 1
  6. Senmori

    Senmori Retired Resource Staff
    Retired Patron

    If Spigot could include Brigadier we'd be happy to slave away at using that instead of the current system.
     
    • Optimistic Optimistic x 2
  7. MiniDigger

    Supporter

    lemme ping bone again about the license issues...
     
    • Like Like x 1
  8. Unfortunately this isn't possible.

    The argument types need to be registered on the client too, because only the type id is able to be sent in the arguments packet. Known argument types are stored in a registry, and then resolved when the packet is received by the client.

    The only way to achieve this is to have a client side mod which registers your argument types.
    Unfortunately I don't think it's a decision he can make. I'd imagine there's a lot of bureaucracy involved with that sort of thing. :( It was the same story with AuthLib.
     
  9. Sorry to hear that. Also happy that I don't need to continue searching :D

    Looks like I have to be satisfied with nms arguments.
     
  10. What kind of custom command argument you wanted to register?
     
  11. MiniDigger

    Supporter

    the last time I talked about that with him, he said he was in talks with ppl, but that kinda busy (it was right after 1.13), but he also said he had more time next week to look at it. I haven't heard anything from him about this topic since then, thats why I pinged him again.
    sure, he can't decide that, but he can pressure his legal teams or his manager to do smth about it.
    it obviously also sucks for him, he created an awesome lib that ppl want to use, but they can't because of bureaucracy.
    I think there is still hope (and once we get a license on brigadier I will be sure to make him look at the case for authlib again), lets see what he has to say, he was not yet online in irc today.
     
  12. One that autocompletes few server methods, to execute as groovy, but that is another topic.
     
    #12 SlimeInSuit, Sep 10, 2018
    Last edited: Sep 10, 2018
  13. You can still achieve that by specifying a string argument type and providing auto completion from the server. The only thing you won't have is input checking / validation on the client.
     
    • Agree Agree x 1
  14. MiniDigger

    Supporter

    16:59 <+Dinnerbone> MiniDigger: I have officially sent the request to make it MIT licensed and open (but not contributable), I will let you know when I get a response
    16:59 <+Dinnerbone> This applies to both Brigadier and DataFixerUpper

    Wooooo
     
    • Winner Winner x 7
    • Like Like x 5
    • Agree Agree x 1
  15. MiniDigger

    Supporter

    When asked why he doesn't want to allow contributions:
    20:00 <+Dinnerbone> Aikar: because I don't have the time right now to handle CLAs and the overhead it'll bring, but I do want to open up contributions later. And since it'd be MIT, people are of course free to fork it as they wish until then.

    so there is still hope for an fully open project

    Anyways, let's hope mircosofts ip lawyers are ok with this but with mircosofts track record in the open source community I don't think it will be an issue. Mircosoft understands the value of OSS.
     
    #15 MiniDigger, Sep 11, 2018
    Last edited: Sep 11, 2018
    • Like Like x 2
    • Agree Agree x 1
  16. I've just deployed version 1.1 of commodore to Maven Central & GitHub.

    Changelog:
    (you can also compare the difference on GitHub)
    • The brigadier version was bumped from 0.1.27 (the version in 1.13) to 1.0.14 (the version in 1.13.1)
    • The brigadier artifact is now downloaded directly from Mojang's maven repository, not my own
    • The lookup method used to setup commodore no longer relies directly on the obfuscated method name, instead it just searches for a method with a matching return type, which should make things a bit more resilient to future MC updates.
    Enjoy :)
     
    • Like Like x 1
    • Useful Useful x 1
  17. MiniDigger

    Supporter

    • Winner Winner x 2
    • Like Like x 1
  18. Yes, a few of the Minecraft PC developers hang around in #mcdevs on Freenode.
     
  19. Damn, that’s cool :eek: glad the library is public now, does it work for lower versions? (The command system itself)