Solved HELP | please help me resolve this problem!

Discussion in 'Spigot Plugin Help' started by eyalfx, May 17, 2016.

  1. Hello,
    Recently me and my friend was making a new plugin but suddenly we got an error.
    we tried to fix that error but it doesn't works, can anyone help?

    ERROR: http://pastebin.com/4gub2bd5
    CODE: http://pastebin.com/3jEaMPtY

    Best wishes,
    Eyal.

    ( btw: I dont know if this is the right forum to ask help ;{ )
     
  2. Show us all your class... Without we can't help you?
     
    • Agree Agree x 3
  3. @Triozer Why do you need the whole class? I sent the important lines...
     
    • Optimistic Optimistic x 2
  4. +1
    I have this bug too
     
    • Informative Informative x 1
  5. It seems like the problem is at line 40 of menu_kitshop would you mind showing us that line of the rest of class
     
  6. I already did.
     
  7. Just send us the line 40. :)
     
  8. http://pastebin.com/3jEaMPtY :)
     
  9. Where is the line, just the line?
     
  10. " if (((e.getAction() == Action.RIGHT_CLICK_AIR) || (e.getAction() == Action.RIGHT_CLICK_BLOCK)) && (p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Kits Shop")))"

    this one I think
     
  11. yes, this one.
     
  12. You have a NullPointerException.. Show us all your code, nobody still it.. c:
     
  13. how can I fix it?
     
  14. @EventHandler
    public void onKitsOpen(PlayerInteractEvent e){

    here starts the if....
     
  15. I think you don't want help.
     
  16. I want help, but you dont get the point of it.
     
  17. You can create a temp pastebin pr go in MP ;D
     
  18. If your code has a NPE and you can't fix it, I don't think anyone's gonna steal your code.
     
  19. I think I see the problem.

    Code (Text):
    if (((e.getAction() == Action.RIGHT_CLICK_AIR) || (e.getAction() == Action.RIGHT_CLICK_BLOCK)) && (p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Kits Shop")))
    I think its because your using too many parenthesis.
    What the if is saying (in english): If the user right clicks air or a block while holding an item named "Kits Shop", open the kits.
    And that would be:

    Code (Text):
    if ((e.getAction() == Action.RIGHT_CLICK_AIR) || (e.getAction() == Action.RIGHT_CLICK_BLOCK) && (p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Kits Shop"))
    I think thats the problem. I haven't tested the code yet but I'm pretty sure it works. It would also help if you gave the whole class also.
     
  20. So, if you want, I think your problem it the parenthesis...

    Replace this:
    Code (Text):
    if (((e.getAction() == Action.RIGHT_CLICK_AIR) || (e.getAction() == Action.RIGHT_CLICK_BLOCK)) && (p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Kits Shop")))
    by this:
    Code (Text):
    if ((e.getAction() == Action.RIGHT_CLICK_AIR) || (e.getAction() == Action.RIGHT_CLICK_BLOCK) && (p.getItemInHand().getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Kits Shop"))

    Raaaaaaaaaah... @Slimedev so fast. x)
     
    • Funny Funny x 1