Spigot CommandsAPI 2.0.1

Create Commands Easily With Annotations and Without plugin.yml

  1. Erezbiox1 submitted a new resource:

    CommandsAPI - Create Commands Easily With Annotations and Without plugin.yml

    Read more about this resource...
     
  2. #2 TJPlaysNow, May 19, 2017
    Last edited: May 19, 2017
  3. Of course you are getting an error,
    This isn't how you supposed to use it, it's not a plugin, it's a library, the thing get's exported long side your plugin.
     
  4. Hmm, I've never done that with a plugin but okk
     
  5. Never used a lib before?
     
  6. It's labeled as API and all of the APIs I've used before I just had in the plugins folder along with my plugin that links into it. But I think I do like it a lot like this!
     
  7. Yeah I know, the title is misleading, The reason for that is at first, BioAPI ( CommandsAPI Parent ) was an actual API
     
  8. Makes sense, thanks for helping me realize how to use it!
     
  9. No problem :)
     
  10. Having trouble finding where I choose to export this together with my plugin.. Could you point me to the right area?
     
  11. What is your IDE?
    In Eclipse, You go to build path, then add external jar
    In Intellij, you go to project structure, modules, add jar
     
  12. I've added the jar. I don't understand how to export the plugin with the jar?

    And I have eclipse
     
  13. Even though it's not supposed to be runnable jar I still export it as one? If not I think I understand. Thanks

    --
    edit:

    Am I just allowed to copy the classes with there path directories from GitHub and add into my project because I did that and it works amazingly. I still have no clue how to add things to export so I'm sticking with what I have unless you say no

    --
    edit:

    I've run into a few errors along the way. When running any of these commands as a Player it gives a message saying "Invalid Arguement please try again!", it's not an invalid argument.

    [​IMG]
    [​IMG]

    Get this nasty error when calling for a list of structures as a player but not as the console.. :/
    [​IMG]
    [​IMG]
     
    #14 TJPlaysNow, May 20, 2017
    Last edited: May 20, 2017
  14. Try version 2.0.1 ( Just released )
     
  15. Hey! I love your API! Is there a way to add OPTIONAL arguments to my commands with this API?
    As within your arguments spoiler, there seems to be no way to add an optional argument. Like, /kill (kills yourself), and /kill <OPTIONALARGUMENT>, kills the specified entity.
    (--Using 1.11.2--)
     
  16. You can do that with an argument marker such as:

    Code (Text):
    @Command (name = "kill", arguments = "*", permissions = "kill.anything")
    public void killSomething(Player player, String[] args) {
        if (args[0].equalsIgnoreCase("@a")) {
            for (Player player : Bukkit.getOnlinePlayers()) {
                player.damage(Double.MAX_VALUE);
            }
        }
    }
    And star is whatever variable the player uses! You could also use two "**" in a row to make it only a number value, however I haven't really used that feature.
     
  17. thank you! Awesome API :)
     
  18. Not my API, however I know a lot about it! :p
     
  19. saying what I said was a fail xD