[Q] Best Way to Handle Commands ?

Discussion in 'BungeeCord Help' started by MineCore, May 29, 2016.

  1. Hey,

    I am pretty new to Java, normally i am working with c++ / c#.
    So but the points is i can work with java very well, but I have a question.
    I read in the wiki that i should add commands like this:
    Code (Text):
    getCommand("example").setExecutor(new ExampleCMD());
    But right now I preffere to make my own CommandHandler Class and use it like this.
    So what I do at the moment is i am just overwriting in the Plugin Main the OnCommand Methode and calling there my CommandHandler:
    Code (Text):
        public boolean onCommand(CommandSender sender, Command command, String cmd, String[] args)
        {
            return cmdHandler.handleCommand(sender, command, cmd, args);
        }
    thats what i am using now.
    But there is also a methode to add a command threw the CommandMap, so whats the best way ? Or it all depents on personal preference ?

    Upps, I am really sorry wanted to post this in the plugin help
     
    #1 MineCore, May 29, 2016
    Last edited: May 29, 2016