Solved PlayerDeathEvent Console Error

Discussion in 'Plugin Development' started by migcabreraes, Nov 19, 2014.

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

    migcabreraes

    I use HoloAPI and minecraft version 1.5.2

    Error:
    Code:
    2014-11-19 20:41:52 [INFO] mige2000 issued server command: /kill
    2014-11-19 20:41:52 [SEVERE] Could not pass event PlayerDeathEvent to AscencionDepend v1.0
    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.SimplePluginManager.fireEvent(SimplePluginManager.java:477)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:462)
        at org.bukkit.craftbukkit.v1_5_R3.event.CraftEventFactory.callPlayerDeathEvent(CraftEventFactory.java:344)
        at net.minecraft.server.v1_5_R3.EntityPlayer.die(EntityPlayer.java:293)
        at org.bukkit.craftbukkit.v1_5_R3.entity.CraftLivingEntity.setHealth(CraftLivingEntity.java:77)
        at org.bukkit.command.defaults.KillCommand.execute(KillCommand.java:33)
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:189)
        at org.bukkit.craftbukkit.v1_5_R3.CraftServer.dispatchCommand(CraftServer.java:523)
        at net.minecraft.server.v1_5_R3.PlayerConnection.handleCommand(PlayerConnection.java:971)
        at net.minecraft.server.v1_5_R3.PlayerConnection.chat(PlayerConnection.java:889)
        at net.minecraft.server.v1_5_R3.PlayerConnection.a(PlayerConnection.java:846)
        at net.minecraft.server.v1_5_R3.Packet3Chat.handle(Packet3Chat.java:44)
        at net.minecraft.server.v1_5_R3.NetworkManager.b(NetworkManager.java:292)
        at net.minecraft.server.v1_5_R3.PlayerConnection.d(PlayerConnection.java:115)
        at net.minecraft.server.v1_5_R3.ServerConnection.b(SourceFile:35)
        at net.minecraft.server.v1_5_R3.DedicatedServerConnection.b(SourceFile:30)
        at net.minecraft.server.v1_5_R3.MinecraftServer.r(MinecraftServer.java:581)
        at net.minecraft.server.v1_5_R3.DedicatedServer.r(DedicatedServer.java:226)
        at net.minecraft.server.v1_5_R3.MinecraftServer.q(MinecraftServer.java:477)
        at net.minecraft.server.v1_5_R3.MinecraftServer.run(MinecraftServer.java:410)
        at net.minecraft.server.v1_5_R3.ThreadServerApplication.run(SourceFile:573)
    Caused by: java.lang.NoSuchMethodError: org.bukkit.entity.Player.getHealth()D
        at com.dsh105.holoapi.api.TagFormatter$8.getValue(TagFormatter.java:96)
        at com.dsh105.holoapi.api.TagFormat.getValue(TagFormat.java:29)
        at com.dsh105.holoapi.api.TagFormatter.formatTags(TagFormatter.java:195)
        at com.dsh105.holoapi.api.TagFormatter.format(TagFormatter.java:212)
        at com.dsh105.holoapi.api.Hologram.generate(Hologram.java:737)
        at com.dsh105.holoapi.api.Hologram.show(Hologram.java:618)
        at com.dsh105.holoapi.api.Hologram.show(Hologram.java:587)
        at com.dsh105.holoapi.api.HologramFactory.build(HologramFactory.java:252)
        at test.com.DeathMSG.onDeath(DeathMSG.java:30)
        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.java:425)
        ... 22 more
    Code:
    Code:java
    1. package test.com;
    2.  
    3. import com.dsh105.holoapi.HoloAPI;
    4. import com.dsh105.holoapi.api.Hologram;
    5. import com.dsh105.holoapi.api.HologramFactory;
    6. import org.bukkit.entity.Player;
    7. import org.bukkit.event.EventHandler;
    8. import org.bukkit.event.Listener;
    9. import org.bukkit.event.entity.PlayerDeathEvent;
    10. import org.bukkit.plugin.java.JavaPlugin;
    11.  
    12. public class DeathMSG extends JavaPlugin implements Listener {
    13.  
    14. public void onEnable() {
    15. this.getServer().getPluginManager().registerEvents(this, this);
    16. }
    17.  
    18. @EventHandler
    19. public void onDeath(PlayerDeathEvent event) {
    20. Player who = event.getEntity();
    21. // Initiate the factory to build our new hologram
    22. final Hologram hologram = new HologramFactory(this)
    23. // This is where we want the hologram to be
    24. .withLocation(who.getLocation())
    25. // This hologram will have two lines of text
    26. .withText("RIP " + who.getName(), "Better luck next time!")
    27. // We don't want this hologram to save to file, so we can set it to a simple hologram
    28. .withSimplicity(true)
    29. // Build the hologram. Also shows to all nearby players
    30. .build();
    31.  
    32. this.getServer().getScheduler().runTaskLater(this, new Runnable() {
    33. @Override
    34. public void run() {
    35. // Remove the hologram that was created above
    36. HoloAPI.getManager().stopTracking(hologram);
    37. }
    38. }, 20 * 30);
    39. }
    40.  
    41. }
     
  2. Offline

    Creeoer

    migcabreraes
    Odd that you would get try to return an entitnty instead of returning the player. Anyways..
    Gotta love stack traces:
    aused by: java.lang.NoSuchMethodError: org.bukkit.entity.Player.getHealth()D
    Looks like there is a problem in an api? Don't count me on that
     
  3. Offline

    mine-care

    Yep this is a API problem...
     
  4. Offline

    ColonelHedgehog

    Your API may be outdated or the creator forgot to leave deprecated old methods, yeah.
     
  5. Offline

    migcabreraes

  6. Offline

    ColonelHedgehog

Thread Status:
Not open for further replies.

Share This Page