Registering commands without plugin.yml

Discussion in 'Spigot Plugin Development' started by bys1, Jun 24, 2016.

  1. How would I register a command without using plugin.yml?
     
  2. Use PlayerCommandPreprocessEvent... that's pretty much your only other option.
     
  3. MiniDigger

    Supporter

  4. MiniDigger

    Supporter

    that is bad as it will not be compatible with other plugins.
     
  5. I know, but that's the only other way I know when it comes to Bukkit.
     
  6. Then don't post if you don't have the experience to or if you didn't even bother googling if there's a different way.
     
  7. MiniDigger

    Supporter

    please don't take your bullshit to this thread too.
     
    • Agree Agree x 4
    • Winner Winner x 2
    • Like Like x 1
    • Funny Funny x 1
  8. MiniDigger

    Supporter

  9. Question... why bother? Plugin.yml isn't hard to set up..................................................................
     
  10. MiniDigger

    Supporter

    dynamic commands.
    users could define commands in the config or create new commands using a command.
    and these are just examples. there are endless possibilities in modifying the command map.
     
    • Agree Agree x 1
    • Informative Informative x 1
  11. You can remove too? If so, it will be useful to block commands :p
     
  12. MiniDigger

    Supporter

    you sure can. just unregister it. thats how everybody should "block" commands. just remove them ;)
     
    • Like Like x 1
  13. Don't see an unregister() method though.
    Do we have to use something with reflections for that too?
     
  14. Code (Java):

        public synchronized void clearCommands() {
            for (Map.Entry<String, Command> entry : knownCommands.entrySet()) {
                entry.getValue().unregister(this);
            }
            knownCommands.clear();
            setDefaultCommands();
        }
     
    This is how you clear all the commands. Now, just modify that to remove the commands of your liking.