Player get Health & get How much Soups he had in he's HotBar

Discussion in 'Plugin Development' started by DeStickyOne, Jan 10, 2014.

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


    Hey Hey Hey !
    i wanna make a PlayerDeathevent
    so its will send the Killer
    Thats he killed e.getentity.getname
    or if (e.getentity instanceof Player)
    Player p = (Player) e.getentity

    i wanna send him how much soups he got in he's hotbar
    how can i get Thats?
    and i wanna send him how much hearts he got ?

    double de = p.gethealth
    not working
  2. Offline


    It looks your trying to do a 1v1 plugin
    Dude first you should look at bukkit's javadocs, it could solve your problem..
    getting health: p.getHealth();
    getting soups:
    int soups = 0;
    1. for (ItemStack is : p.getInventory().getContents()){
    2. if (is != null && is.getType() == Material.MUSHROOM_SOUP){
    3. soups++;
    4. }
    5. }
  3. umm... Could you please send us your code / error log / more details if any? We couldn't help much without them.
  4. Offline


    Why isn't working? It works fine.. p.getHealth() returns a double.
  5. Offline


    The method getHealth() is ambiguous for the type Player
  6. Offline


    Use bukkit, not craftbukkit
  7. Offline


    If he wants to use craftbukkit, he could always use ((CraftPlayer) player).getHealth();
  8. Offline


    Yes but using bukkit is better than using craftbukkit (even Staff members allow with that)
    werter318 likes this.
  9. Offline


    Thanks so much i just found your post and my god you saved me
  10. Offline


    The CraftPlayer import changes each update, so unless you wanna force yourself to update each time then use

    ((Damageable) player).getHealth();
  11. Offline


    Thanks also is it wise to just make the move to normal bukkit instead of craftbukkit?
    moved to spiggot so using bukkit not craft bukkit but
    ((Damageable) player).getHealth();
    still works so cheers
Thread Status:
Not open for further replies.

Share This Page