What does getCommands() return?

Discussion in 'Spigot Plugin Development' started by Geckoco, Apr 28, 2017.

  1. What does getCommands() return?
    The wiki doesn't really explain it too well, or at least I don't understand it

    What I want to do is have the command name and description put into an array
     
  2. I am I meant javadocs not wiki
     
  3. What? That actually is already mentioned on that site,
    "Gives the map of command-name to command-properties. Each entry in this map corresponds to a single command and the respective values are the properties of the command."

    "Map<String,Map<String,Object>> getCommands()"
    That would actually return a map with a string ( command name ) and their used informations like "description"
    So you would call that similar to this:

    Code (Text):

    for(Map.Entry<String,Map<String,Object>> mapEntries : getCommands()){
        String command = mapEntries.getKey();
        Map<String,Object> commandInformations = mapEntries.getValue();
        String description = commandInformations.get("description");
        //description can be null if it doesn't exist in the map. All other informations that can be found are listed on that site. ("description","aliases","permission","permission-message","usage")
    }
     
     
    • Like Like x 1