I am having a problem with checking player health, when i use the .getHeatlh(int) on a player entity, eclipse says ".getHealth(int) is ambiguous for the type player" any idea how to fix this/ work around?
Lolmewn I thought doubles were used now... @Anerdson http://forums.bukkit.org/threads/oops-i-didnt-break-your-plugins-ambiguous-gethealth.156975/
Ok well i tried switching it to a double but i still get the same problem, "The menthod 'getHealth() is ambiguous for the type Player" And yes i have read through that now, it was semi-useful
I use this in my plugin: Code:java double currentHealth = player.getHealth(); Must be a double or it will throw errors.
I tried exactly that, and eclipse still throws the error "The menthod 'getHealth() is ambiguous for the type Player"
Anerdson OHHH I know why. Use this to compile the plugin: http://dl.bukkit.org/downloads/bukkit/ Beta build of BUKKIT not CRAFTBUKKIT
Anerdson Well, all I know is: Bukkit = For Coding Craftbukkit = For servers/coding Try it, that's why I had to start using bukkit. And there's no difference in the plugin. Still works with all craftbukkit servers.
I first make the variable with the listener class as the variable(in main class, above onenable()/onDisabled()): Code:java public final InteractListener1 bl = new InteractListener1(this); Then I use this in onEnable() to register it: Code:java PluginManager pm = getServer().getPluginManager(); pm.registerEvents(this.bl, this);
HeyAwesomePeople Do you ever use the variable again? Otherwise you could just make the variable when registering the events. At least, that's how I always do it. Also, if anyone comes in here and has the same issue + uses Maven, prioritize Bukkit above Craftbukkit. You need both.
@HeyAwesomePeople Is all of that in the main class? Or is part in the listener class? Also What is the b1?
HeyAwesomePeople Ok the "= new ExampleListener (this);" is coming with an error: "The constructor ExampleListener(Main) is undefined"
HeyAwesomePeople Okay well i did that, did everything, and now when i tested the plugin nothing happend! I checked the server logs and the plugin loaded properly, and when i tested it, it never did anything (didn't even log and error)
Anerdson No, Loogeh! It would make no sense why the health would be a long now, because so high health values will never exist. Health is now saved as a float by minecraft and because bukkit don't want to do such a thing a second time they used doubles. To avoid ambigous errors add bukkit as a dependency instead or before adding craftbukkit.