Cannot create instance of own plugin in another class

Discussion in 'Plugin Development' started by BAI1, Nov 19, 2014.

Thread Status:
Not open for further replies.
  1. Offline

    BAI1

    I really don't know how to put it into few words, hence the large-ish title.

    So I have a plugin which I'm making. I've already got one plugin and the plugin I'm making can hook into that PERFECTLY without any issues. I'm able to use all the methods I need from my other plugin without issues, which is entirely the point and exactly what I want.

    The plugin I'm making now needs commands, and that's where it dies. I've looked through the source of my other plugin and took the bit I used to make it possible to use the methods from my main class and altered the variables. This, for some mysterious reason, isn't working. It works fine if I use it with other plugins but it refuses to work point blank with my in-dev plugin unless it's in the main class to begin with.

    Main class as of present:
    http://pastebin.com/es0UnMKw

    This compiles with the only error being that it can't find cmd_announce (fair enough, but commenting out that block it works fine).

    cmd_announce:
    http://pastebin.com/hknBLFJM

    This class errors in three places during compilation. Two of them are on this line:
    Code:java
    1. NewAnnouncer NewAnnouncer = (NewAnnouncer) Bukkit.getServer().getPluginManager().getPlugin("NewAnnouncer");

    Want to guess where they both are? The "NewAnnouncer" and "(NewAnnouncer)" if it's not obvious. Errors with "Cannot find symbol". This also happens if I try to import me.bai1.NewAnnouncer.NewAnnouncer; as well.

    I code 99% of the time using Notepad++ and a Cygwin terminal, because easy and I dislike Eclipse. It has a horrible way of making popups appear everytime I type something, ever, and to be perfectly honest I prefer Notepad++ because I've been using it for various other coding expriments and work (HTML/CSS, Batch, Bash, and reading source code of other plugins where needs be).

    Compilation method: Cygwin terminal on a Windows 7 OS running a portable version of OpenJDK 7.
    Command: javac -cp "reqs/craftbukkit-1.7.2-R0.2.jar"\;"reqs/NewTrans.jar"\;"NewAnnouncer.jar" FILENAME.java
    Directory structure is as below:
    NewAnnouncer:
    |-Reqs
    |---craftbukkit-1.7.2-R0.2.jar
    |---NewTrans.jar
    |-NewAnnouncer.jar
    |-NewAnnouncer.java
    |-cmd_announce.java

    I've tried numerous different ways of attempting to link into my main class including trying different type names (EG: "NA", "NewAnn", "NewAnnounce", "newAnnouncer" and similar) to no avail. I triple-checked the names of the classes and other resources and none of them are, to my knowledge, incorrect.

    If there's other errors in the code I'm not too bothered about those, I'll spot them usually before I release the plugin anyway, but if you want to point them out feel free to. The thing I want fixed is that I CAN'T hook into my main class here whereas I've been perfectly capable of doing it with my first plugin and with my main class linking into that plugin.
    Thanks.
    ~BAI1
     
  2. Offline

    Skionz

    Is it in your build path? I'm not really sure how you would do that with text edit.
     
  3. Offline

    BAI1

    Build path referring to the command I use? Not sure but I've checked the filename and location, and both seem to be valid. It does act as if it's not even reading the -cp for NewAnnouncer.jar, although once I get home I'll be able to double-check filenames with more accuracy.
    BAI1
     
Thread Status:
Not open for further replies.

Share This Page