NoSuchMethodError on getShooter()

Discussion in 'Plugin Development' started by UnrealPowerz, Mar 9, 2014.

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

    UnrealPowerz

    Hi everyone,

    I can't seem to get the getShooter() method to work.
    I know it now is a ProjectileSource thing or something like that, but my server says the method doesn't even exist.
    I'm using the latest dev build of both Bukkit and CraftBukkit.

    Stacktrace:
    Code:java
    1. [13:15:23] [Server thread/ERROR]: Could not pass event ProjectileLaunchEvent to FireworkArrows v0.5
    2. org.bukkit.event.EventException
    3. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    4. at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    5. at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:481) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    6. at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:466) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    7. at org.bukkit.craftbukkit.v1_7_R1.event.CraftEventFactory.callProjectileLaunchEvent(CraftEventFactory.java:597) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    8. at net.minecraft.server.v1_7_R1.World.addEntity(World.java:904) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    9. at net.minecraft.server.v1_7_R1.World.addEntity(World.java:871) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    10. at net.minecraft.server.v1_7_R1.ItemBow.a(ItemBow.java:59) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    11. at net.minecraft.server.v1_7_R1.ItemStack.b(ItemStack.java:319) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    12. at net.minecraft.server.v1_7_R1.EntityHuman.by(EntityHuman.java:103) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    13. at net.minecraft.server.v1_7_R1.PlayerConnection.a(PlayerConnection.java:498) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    14. at net.minecraft.server.v1_7_R1.PacketPlayInBlockDig.a(SourceFile:53) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    15. at net.minecraft.server.v1_7_R1.PacketPlayInBlockDig.handle(SourceFile:8) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    16. at net.minecraft.server.v1_7_R1.NetworkManager.a(NetworkManager.java:146) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    17. at net.minecraft.server.v1_7_R1.ServerConnection.c(SourceFile:134) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    18. at net.minecraft.server.v1_7_R1.MinecraftServer.u(MinecraftServer.java:655) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    19. at net.minecraft.server.v1_7_R1.DedicatedServer.u(DedicatedServer.java:250) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    20. at net.minecraft.server.v1_7_R1.MinecraftServer.t(MinecraftServer.java:545) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    21. at net.minecraft.server.v1_7_R1.MinecraftServer.run(MinecraftServer.java:457) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    22. at net.minecraft.server.v1_7_R1.ThreadServerApplication.run(SourceFile:617) [craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    23. Caused by: java.lang.NoSuchMethodError: org.bukkit.entity.Projectile.getShooter()Lorg/bukkit/projectiles/ProjectileSource;
    24. at me.unrealpowerz.fireworkarrows.listeners.ArrowTypeHandler.onProjectileLaunch(ArrowTypeHandler.java:60) ~[?:?]
    25. at sun.reflect.GeneratedMethodAccessor5.invoke(Unknown Source) ~[?:?]
    26. at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]
    27. at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]
    28. at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:318) ~[craftbukkit-1.7.2-R0.3-20131225.043511-4.jar:git-Bukkit-1.7.2-R0.2-3-g530fcb7-b2978jnks]
    29. ... 19 more
    30.  


    ArrowTypeHandler.java:60: (line 3 here)
    Code:java
    1. @EventHandler
    2. public void onProjectileLaunch(ProjectileLaunchEvent event) {
    3. if((event.getEntity().getShooter() instanceof Player && event.getEntity() instanceof Arrow) && (FireworkArrows.plugin.getConfig().getBoolean("enabled"))) {


    What am i doing wrong here?
     
  2. Offline

    Fred12i12i

    You need to add @EventHandler
     
  3. Offline

    Barinade

    Make sure it's a projectile first.
    Didn't pay close enough attention.
    Is your referenced library and server runnable the same?

    Fred12i12i Do you think he'd even reach the error without the annotation? ...
     
    bennie3211 likes this.
  4. Offline

    UnrealPowerz

    Referenced library: bukkit-1.7.2-R0.4-20140216.011848-2.jar
    Server: craftbukkit-1.7.2-R0.4-20140216.012104-3.jar

    They are both the latest.
     
  5. Offline

    GameplayJDK

    Look at the bold numbers. They are not the same for booth.. So since they are different ones, they are not the same.
     
  6. Offline

    UnrealPowerz

    Well, i can't find the same files.
    And it looks like CraftBukkit has been built about twice as much as Bukkit.
    You're not gonna tell me each version of CraftBukkit has its' very own version of Bukkit.
     
  7. Offline

    NathanWolf

    The most recent version of bukkit has some changes to the projectile stuff, but I *think* they are doing something sneaky with legacy support via maven, which makes the method signature look different. If you look at the source, you can find the old method still there with a weird name, and I think it's still callable at runtime.

    This I conjecture on my part, but that seems like what is going on, which makes it annoying if you're trying to check for compile time errors or use your IDE to find the method from source.

    That said I can't really be more help here I just know this was a recent dev build change that seems to break several plugins I've looked at in my IDE, even though they run ok.
     
  8. Offline

    UnrealPowerz

    I guess i'll wait for a 1.7.2 beta then.
     
Thread Status:
Not open for further replies.

Share This Page