[Abandoned] Time = null

Discussion in 'Spigot Plugin Development' started by dyenxunit, May 29, 2015.

  1. Abandoned
     
    #1 dyenxunit, May 29, 2015
    Last edited: May 30, 2015
  2. Plugin is null when you execute the command 'test'. It is very helpfull if you know how to read stacktraces m8.
     
  3. Serializator

    Supporter

    The plugin variable is null, not your countdown time.
     
  4. Ahh i see i will go and fix this and see if it works thx for the help :)
     
  5. Did you ever set your HashMap = to a new HashMap?
     
  6. Nope not yet still trying to just get the bases working.
     
  7. This is what i have for the plugin variable
    Main plugin;

    public CommandEvent(Main plugin){

    this.plugin = plugin;

    }
    but why is it saying null ?
     
  8. Well that could cause a NPE.
     
  9. Did you ever instantiate the CommandEvent class?
     
  10. How do i do that ? sorry im a fairly new dev
     
  11. Before learning Bukkit, I recommend learning the basics of Java first. It will help you out greatly.

    But, instantiating a class, or object, is basically setting it's value.

    Here's an example:
    Code (Text):
    private MyObject myObjectName;

    System.out.println(myObjectName.toString()); // NPE, you never set myObjectName to anything.

    private MyObject myObjectName1 = new MyObject();

    System.out.println(myObjectName1.toString()); // Will work, because you gave it a value, or instantiated it.

     
    Hope this helped.
     
  12. Can someone help me with the error because i have tried almost every method that i know and it still doesnt work. The count down was working when i had this in 1 main class but idk how to add it to my plugin where it is multiple classes
     
  13. That's where learning Java before Bukkit comes in handy. ;)
     
  14. yea i know but this is a side hobbie for me but im slowly learning as i go forward with coding. This is the only thing that is not working or i would be finished with my plugin :(
     
  15. at me.dyenxunit.magnum.Main.Events.CommandEvent.onCommand(CommandEvent.java:58)
     
  16. This is whats on line 58 });
     
  17. Replace that with:
    Code (Text):
    int ticks = seconds * 20
    }, ticks);
     
  18. It might help if you were to paste your code in pastebin, so we can see that.
     
  19. can i send a private pm because i dont want to release my full class to everyone
     
  20. No one is going to steal your code if it isn't working.