Question about plugin.yml etc

Discussion in 'Spigot Plugin Development' started by Kyllian, Apr 24, 2017.

  1. Hey,

    I've been wondering. How can I not register a command in plugin.yml so it gets registered in the plugin when the plugin starts. So people can tell what they would like to enable/disable

    Greetings
     
  2. Why not use CommandHandlers?

    On Enable:
    If command.x is true
    new Command(handler)
     
  3. What do U mean, I have seperate classes now. But when they are in the plugin.yml, they get registered in my plugin, wich overrides other plugins. Thats what i dont want
     
  4. Yes, this is definitely possible. For example, MassiveCraft uses it in their core. A player can define command aliases in a configuration and it would automaticly update them, without even restarting.

    Take a look at how it's done here:
    https://github.com/MassiveCraft/Mas...ine/EngineMassiveCoreCommandRegistration.java
     
  5. md_5

    Administrator Developer

    No, plugin commands must be in plugin.yml
    If you want a command disabled you should limit access with permissions.
    If you want another plugin to take preference with a command then you should instruct your users to use commands.yml
    They probably did that before commands.yml existed.
    Now that commands.yml exists, no plugin should be doing the above.
     
  6. Aha! Didn't know that existed. Should I add it like a config?

    So, my command.yml should look like this?

    Code (Text):
    command-block-overrides:
        - "ban"
        - "kick"
        - "etc"
    And when they wish to disable it. Just remove the line?
     
  7. md_5

    Administrator Developer

    commands.yml is a server level option.
    For general command "disabling" they simply don't give players the permissions required to use it.
    If there is a case where another plugin is overriding your command (or vice versa), then you can add an alias to force the right command, eg:
    Code (Text):
    aliases:
      ban:
      - awesomeplugin:ban $1-
     
    • Useful Useful x 1
  8. Ooh yes! I understand it. Thanks :D!
     
  9. They're still using it even today. They do it to allow people to set their own commands and give them a unique experience, as seen in the code comments. It's extremely hacky-wacky but is it really a bad thing to do? I personally like the feature :p
     
  10. md_5

    Administrator Developer

    Looks like its just dynamic aliasing which is what commands.yml is for
     
  11. Forcing my downloaders to use commands.yml is even easier ^-^.

    And if my plugin wouldnt contain 40+ commands I would love to try out your API :p
     
  12. I use it in all of my plugins, small and big one combined
    Anyway, more then 10 commands with plugin.yml is practically impossible.
    If you can write something in the thread it will be awesome! =)
     
  13. It's more that if I want to use your API. I completely need to ditch everything I made (Look at my system32 plugin) and recreate everything, wich is quite much (look at it again)
    Maybe in a future project :)
     
  14. k
    Just saying in your case It's even better, because you can change the register class to fit your needs, for example block commands via config ( first thing I saw when I looked at your resource, so yeah )
    But yeah I get it, Ain't broke why fix it?
     
    • Agree Agree x 1