Could not pass event PlayerInteractEvent

Discussion in 'Spigot Plugin Development' started by Deltazura, Jun 21, 2016.

  1. Hi everyone, I had this error, and i would like to take off this error, can you help me please ?
    http://pastebin.com/7hd6rU0b

    I really need your help
     
  2. Can you show line 545 in your main class, as well as posting the entire main class.
     
  3. You are using the new getTargetBlock(Set, Integer) method I added in. It didnt exist for the server version you are running. Update your server or downgrade your code.
     
  4. How can i do ?
    Sorry, but i'm bad in english and i don't understand the second part of your message :/
     
  5. getTargetBlock(HashSet<Byte>, Integer) is the old method that will work for older servers. This method will be removed in the future, though, so it is advised to just update your server instead.
     
    • Like Like x 1
  6. Okey, thanks for you answer i will update my server version
     
  7. You were getting a NoSuchMethodError. I just wanted to see the method you were trying to use and what you may have been trying to do. However, @BillyGalbreath seems to know more on this than I do, so I'm going to leave this to him.
     
  8. Caused by: java.lang.NoSuchMethodError: org.bukkit.entity.Player.getTargetBlock(Ljava/util/Set;I)Lorg/bukkit/block/Block;

    Thats the method. https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/LivingEntity.html#getTargetBlock(java.util.Set, int)

    This method will only work on newer servers (it was introduced in 1.8.x, but not in the early builds).

    This is the method to use for older servers.
     
    • Like Like x 1
  9. It's working, i update my server and it's working, thanks for tour help ! Thank you very mush !
     
    • Like Like x 1
  10. Oh yea, look at that, right next to the NoSuchMethod error in log. Anyway, wouldn't his IDE give an error if he was using a method that didn't exist? Unless his server version and the version he is using as a dependency in his IDE are different.
     
  11. He probably used the newer API in his IDE.