Solved API Creation

Discussion in 'Spigot Plugin Development' started by snakedoctor101, Jun 2, 2018.

Thread Status:
Not open for further replies.
  1. I'm trying to make an API for random stuff that I might find useful in future plugins.
    I have my abstract interface, class implementing abstract interface, and all of the things set up in both. In the abstract interface, I have the methods without a body, however they are the exact same . I also have a class which is not implementing the abstract interface. Do I define them in the class not implementing AI or the class implementing AI? Thanks.

    If this is too confusing to understand, I'm happy to give code examples.
     
  2. Hi, how many months do you learn java? Because of to make an API you have to be an expert on java and as I see you have only two plugins... it's not as easy as you think, you have to work hours and weeks/months unstoppable to code it.
     
    #2 Teh_Matt_GRyt, Jun 2, 2018
    Last edited: Jun 2, 2018
    • Funny Funny x 2
    • Optimistic Optimistic x 1
  3. I quite disagree. Making a simple API is not that difficult and definitely does not require one to be an "expert at Java", or "weeks/months" of time to complete.
    However, it does require the understanding of some core Java concepts and the build process, which can be tough to learn if you start out using Spigot. Still, I will try to answer OP's question best I can.

    I'm not 100% certain I know what you mean, but from what I gather, you have an interface MyInterface and a class MyInterfaceImpl that implements MyInterface. Also, you have an additional class SomeClass, that does not inherit from either MyInterface or MyInterfaceImpl.
    Now, your question is whether to implement the methods you have defined in MyInterface in MyInterfaceImpl or SomeClass? I think the answer to this should be pretty obvious.
    If I got you wrong, please do post code examples :p

    On a side note, I'm assuming you want your API to be a plugin that can be installed on a server like any other but can be depended on and used by other plugins. In this case, be sure to add "depend: [MyAPI]" to the plugin.yml and the JAR itself to the classpath of your dependent projects. (The latter can be achieved for example by some build tool like Maven)
     
    • Like Like x 1
  4. Just because I only have two plugins posted on Spigot, does not mean that they are the only ones I've created.

    Thanks, I figured it out.
     
Thread Status:
Not open for further replies.