[Fixed]

Discussion in 'Spigot Plugin Development' started by SlimeGamer, Jul 4, 2015.

  1. Fixed
     
    #1 SlimeGamer, Jul 4, 2015
    Last edited: Jul 4, 2015
  2. Can you post your whole class in a hastebin?
     
  3. Code (Text):
    Caused by: java.lang.NullPointerException
            at portalmc.TokensAPI.CoinsAPI.getFile(CoinsAPI.java:59) ~[?:?]
            at portalmc.TokensAPI.CoinsAPI.getConfig(CoinsAPI.java:54) ~[?:?]
            at portalmc.TokensAPI.CoinsAPI.get(CoinsAPI.java:49) ~[?:?]
            at me.itzH4perSkiLlz.main.onJoin(main.java:112) ~[?:?]
    Something on that line is null, and without seeing your whole class we can't possibly know whats on that line.
    Also next time you want to post code, please click Insert>Code
     
  4. It is not possible for us to find the error without taking a look at the code. Also, as @Bimmr said ^ something at those line is null. Or it could be possible that something other code has to do with this.
     
  5. Although i'd imagine it has something to do with the fact that you set this as null
    Code (Text):
    Player player = null; //Quitar si no funciona
    mainObjective.getScore("§7"+ CoinsAPI.get(player)).setScore(3); //Tambien el + CoinsAPI.get(player) no olvidar
     
    • Agree Agree x 3
    • Funny Funny x 1
    • Winner Winner x 1
  6. Without postin the entire class code the problem is impossible to diagnose. As the lines provided by p/hastebin don't line up with the one produced in your error. The line in the error message after Caused By: null pointer, is where the problem exists.
     
  7. No need post all class me remove this is working:eek:
     
    • Funny Funny x 1
  8. Inkzzz

    Resource Staff

    You're getting an error, because your setting the scoreboard before. Move it to the end after setting the scores etc.
     
  9. You're not understanding. We need the entire file from line 1. You left our your package and imports, which is going to change the line numbers we are looking at. We dont know what line 59 is because you wont post the whole thing.
     
  10. This class is a private code :/
     
  11. Itss registred
     
  12. Then at least mark to us what line 59 is.... We're not mind readers here, sadly.
     
  13. Just follow the stack trace:
    Code (Text):
    at me.itzH4perSkiLlz.main.onJoin(main.java:112) ~[?:?]
    Which is: http://hastebin.com/xurefikule.avrasm
    Code (Text):
    at portalmc.TokensAPI.CoinsAPI.get(CoinsAPI.java:49) ~[?:?]
    And there is only one call to CoinsAPI.get:
    Code (Text):
    mainObjective.getScore("§7"+ CoinsAPI.get(player)).setScore(3);
    We can then assume the problem is the variable player:
    Code (Text):
    Player player = null;
     
  14. and how to fix it?
     
  15. I know how to read a stacktrace. That wasn't my point. My point is the OP is expecting us to go out of our way to help. I dont get paid for this. Do you? I will help someone that can meet me halfway. I dont want to spend more than 5 seconds hunting down something that could be easily pointed out by the OP.

    http://sscce.org/
     
  16. Instead of:
    Code (Text):
    Player player = null; //Quitar si no funciona
    Get the player from the event:
    Code (Text):
    Player player = p.getPlayer();
     
  17. JustThiemo

    JustThiemo Previously TrinityDEV

    Lel, make it not null, give it a real variable for players..
     
  18. Inkzzz

    Resource Staff

    Well, you'd do Player p = e.getPlayer();