java.lang.AbstractMethodError

Discussion in 'Plugin Development' started by rsod, Aug 4, 2013.

Thread Status:
Not open for further replies.
  1. Code:
    2013-08-03 20:35:54 [INFO] Melly258PL issued server command: /eat
    2013-08-03 20:35:54 [SEVERE] Could not pass event FoodLevelChangeEvent to WildfireClasses v0.1
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:427)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.TimedRegisteredListener.callEvent(TimedRegisteredListener.java:46)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:478)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:463)
    at com.earth2me.essentials.commands.Commandfeed.feedPlayer(Commandfeed.java:96)
    at com.earth2me.essentials.commands.Commandfeed.run(Commandfeed.java:42)
    at com.earth2me.essentials.commands.EssentialsCommand.run(EssentialsCommand.java:134)
    at com.earth2me.essentials.Essentials.onCommandEssentials(Essentials.java:441)
    at com.earth2me.essentials.Essentials.onCommand(Essentials.java:330)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:190)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServer.java:527)
    at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerConnection.java:981)
    at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.java:892)
    at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java:839)
    at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49)
    at org.spigotmc.netty.NettyNetworkManager.b(NettyNetworkManager.java:230)
    at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java:118)
    at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37)
    at org.spigotmc.netty.NettyServerConnection.b(NettyServerConnection.java:125)
    at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:592)
    at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:239)
    at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:481)
    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java:413)
    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:582)
    Caused by: java.lang.AbstractMethodError
    at org.rsod.WildfireClasses.ClassSurvivalist.onFoodLevelChange(ClassSurvivalist.java:212)
    at sun.reflect.GeneratedMethodAccessor971.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:601)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:425)
    ... 25 more
    
    I have no clue what can cause this problem to happend. Here is that FoodLevelChangeEvent: http://pastebin.com/Z8cAf5Zt

    line 212 is:
    Code:
    int h = (int) pl.getHealth();
     
  2. Offline

    Adversarius

    What is your pl(ayer)?
    How you created/get it?
     
  3. rsod
    Health is now a double, not an integer.
     
  4. Rocoty likes this.
  5. Offline

    Adversarius

    the explicit cast from double to int is no problem, as long as you know that you are doing this.

    I cant use the getHealth() method, too. My IDE marks it as wrong.
    "The method getHealth() is ambiguous for the type Player"


    There you should find a solution, i start reading a bit, too:
    http://forums.bukkit.org/threads/oops-i-didnt-break-your-plugins-ambiguous-gethealth.156975/


    Edit:
    Solution: Use bukkit instead of craftbukkit for the plugin development:
    http://dl.bukkit.org/downloads/bukkit/
    Server still runs on craftbukkit
     
  6. Offline

    Wolvereness Bukkit Team Member

    Don't use spigot.
     
  7. happening with latest bukkit too, Wolvereness
    Code:
    17:46:20 [INFO] rsod issued server command: /eat
    17:46:20 [SEVERE] Could not pass event FoodLevelChangeEvent to WildfireClasses v
    0.1
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:427)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.jav
    a:62)
    at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.j
    ava:477)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.j
    ava:462)
    at com.earth2me.essentials.commands.Commandfeed.feedPlayer(Commandfeed.j
    ava:96)
    at com.earth2me.essentials.commands.Commandfeed.run(Commandfeed.java:42)
    
    at com.earth2me.essentials.commands.EssentialsCommand.run(EssentialsComm
    and.java:134)
    at com.earth2me.essentials.Essentials.onCommandEssentials(Essentials.jav
    a:441)
    at com.earth2me.essentials.Essentials.onCommand(Essentials.java:330)
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:19
    1)
    at org.bukkit.craftbukkit.v1_6_R2.CraftServer.dispatchCommand(CraftServe
    r.java:523)
    at net.minecraft.server.v1_6_R2.PlayerConnection.handleCommand(PlayerCon
    nection.java:962)
    at net.minecraft.server.v1_6_R2.PlayerConnection.chat(PlayerConnection.j
    ava:880)
    at net.minecraft.server.v1_6_R2.PlayerConnection.a(PlayerConnection.java
    :837)
    at net.minecraft.server.v1_6_R2.Packet3Chat.handle(SourceFile:49)
    at net.minecraft.server.v1_6_R2.NetworkManager.b(NetworkManager.java:296
    )
    at net.minecraft.server.v1_6_R2.PlayerConnection.e(PlayerConnection.java
    :116)
    at net.minecraft.server.v1_6_R2.ServerConnection.b(SourceFile:37)
    at net.minecraft.server.v1_6_R2.DedicatedServerConnection.b(SourceFile:3
    0)
    at net.minecraft.server.v1_6_R2.MinecraftServer.t(MinecraftServer.java:5
    90)
    at net.minecraft.server.v1_6_R2.DedicatedServer.t(DedicatedServer.java:2
    26)
    at net.minecraft.server.v1_6_R2.MinecraftServer.s(MinecraftServer.java:4
    86)
    at net.minecraft.server.v1_6_R2.MinecraftServer.run(MinecraftServer.java
    :419)
    at net.minecraft.server.v1_6_R2.ThreadServerApplication.run(SourceFile:5
    82)
    Caused by: java.lang.AbstractMethodError: com.earth2me.essentials.User.getHealth
    ()D
    at org.rsod.WildfireClasses.ClassSurvivalist.onFoodLevelChange(ClassSurv
    ivalist.java:211)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.ja
    va:425)
    ... 24 more
    >
    I assume it happening when plugin tries to change food level.. But is it essentials error or my plugin error?
     
  8. Offline

    Adversarius

    see my post #5.
    Bukkit had to change the getHealth() Method.
    You have to use the right bukkit-jar for development
     
  9. Offline

    Wolvereness Bukkit Team Member

    Let me boil this down for you:
    Code:
    Caused by: java.lang.AbstractMethodError: com.earth2me.essentials.User.getHealth ()D
    It means there does not exist a getHealth method that takes no parameters, returns a double, in the class User of package com.earth2me.essentials.

    Therefor, you are either compiling against Essentials and the jar you compile against is not the one on the server, xor Essentials extends the event in an unsafe way.
     
  10. Wolvereness most likely second, because I'm not compiling against Essentials at all. Well, surrounding that code part with "try {} catch" should work fine.
     
Thread Status:
Not open for further replies.

Share This Page