Plugin Help bukkit getCommand("...").setExecutor always null pointer

Discussion in 'Plugin Help/Development/Requests' started by causticlasagne, Nov 25, 2015.

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

    causticlasagne

    Ugh. I'm having yet another problem in my grand eclipse and java plugin development.

    I have a line in 2 plugins that is exactly the same... kind of, except the names and stuff.

    commandhandler ch = new commandhandler(this);
    getCommand("clsinv").setExecutor(ch);

    The above works in my first plugin with no issues.
    References a class called commandhandler

    CompassCommands cc = new CompassCommands(this);

    getCommand("cpgwarp").setExecutor(cc); <- Exception
    However, the above code does not work, as it always returns a nullpointerexception.
    This code references a class called CompassCommands

    Can anybody point out what's wrong or have I missed something and are staring blankly at it.... again?

    Cheers CausticLasagne.
    As always, don't be afraid to ask for source.. within reason.
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    causticlasagne

    Here is is.
    Bukkit forums won't allow uploading of a .yml file for some reason.
    I've appended .txt to the end of the file.
    (Admins hate this: I'll be online at about 1200 +0800 tomorrow)
     

    Attached Files:

    Last edited: Nov 25, 2015
  4. Offline

    causticlasagne

    Ugh. I figured it out. After you requested my plugin.yml, I thought.. It must be something to do with that. Then whilst making a new plugin, I changed the command in plugin.yml and it clicked.

    Why does bukkit spew nonsense when the plugin.yml command is not the same as the one being registered?
    To Bukkit Devs: Please make it print a message alongside the stacktrace. It would save a lot of time.
     
  5. Online

    timtower Administrator Administrator Moderator

    @causticlasagne Bukkit doesn't know what could be causing it, people do.
     
  6. Offline

    Mrs. bwfctower

    You realize Bukkit is no longer under development, right?

    Not nonsense. It shows, well, a stack trace. A list of method calls that were happening when the exception was thrown.
     
    teej107 likes this.
  7. Offline

    teej107

    Mrs. bwfctower likes this.
  8. Offline

    causticlasagne

    Yeah, idk. I'm running spigot, but isn't that a fork or something of bukkit? (1.8.8)
    In the stacktrace, they should just print a list of the erroring classes, and go into more detail of what caused the error.
    I guess it's a generic thing though because c# and other .net languages to it too.
     
  9. Offline

    mcdorli

    Or maybe, they shouldn't? What takes more time? To learn to read stack-traces (10 minutes) or to implement an error tracking algorithm (half year)?
     
  10. Offline

    Firestar311

    @causticlasagne When it prints a stacktrace, just follow it through, that is the easiest way to troubleshoot something. It even gives you line numbers. If it has to do with a command, its the plugin.yml.
     
Thread Status:
Not open for further replies.

Share This Page