How do I make an API?

Discussion in 'Spigot Discussion' started by RyanH, Jun 14, 2016.

  1. Hi, I'm interested in contributing to the community on Spigot by creating an API with methods to make certain tasks easier. This would shorten the work you have to put into your plugin, and would enlighten me if I could help someone out.

    I want to know the proper way to import methods into someone elses plugin, by adding a 'JAR' file to the build path. For example, if someone typed this into their plugin:

    Code (Text):

    public void onEnable() {

         if(iscool("cool")) {

          // Do stuff


    So, in my API I would have that method.

    Code (Text):

    public boolean iscool(String value) {

         return true;

         return false;


    Sorry if the method is a little ruptured, I'm typing this on my phone. Right, anyway... So, if I imported a JAR file containing that method 'iscool' into the BuildPath how would I make that function inside the actual plugin if someone else used the API. Thanks for telling me! Please don't link a WIKI Page, explaining an API, or some article. I'm a newbie at this, and can't understand. <3

    NOTE: If you come across a video explaining this, DIRECTLY RELATED to Bukkit/Spigot please tell me! I haven't found one myself, but that be very useful!

    • Optimistic Optimistic x 1
  2. Just package it as a Jar and people would be able to call it via ClassInstanceVAR.isCool("cool");
  3. I'm doing this correctly, just that part?
  4. I too am interested in this, any other information would be extremely helpful. @RyanH have you made any progress?
  5. What exactly are you trying to achieve? Are you trying to make an API, framework or library? Because it's extremely unclear from your example. Your example reassembles more that of a library, rather than an API.
    • Useful Useful x 1
  6. Yes
  7. An API is just a utility, designed to make developers lives easier. Like ProtocolLib or LibDisguises, they're just there for making peoples lives easier.
  8. aWolfWizard is wright, but why you need an API you can download 10000 API´s in Web. Check it out.
  9. Why recreate the wheel when you can already use someone elses design :p
  10. clip


    Don't take this response the wrong way but just think about this for a minute.....

    If you don't have any idea on how to create or structure an API, what makes you think your API is going to be useful beneficial to others.
    • Agree Agree x 2
  11. That's wrong. ProtocolLib(rary) and Lib(rary)Disguises and libraries. An API is a way of interacting with an application, any extending functionality.
    • Agree Agree x 3
    • Useful Useful x 1
  12. The point I was trying to make is it's something to make developers like more simpler.