Solved The method getHealth() is ambiguous for the type Player

Discussion in 'Plugin Development' started by MgMaor, Jul 4, 2013.

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

    MgMaor

    Code:java
    1. @EventHandler
    2. public void act(PlayerInteractEvent e){
    3. Player p = (Player) e.getPlayer();
    4. Action a = (Action) e.getAction();
    5.  
    6.  
    7.  
    8.  
    9. //Soup
    10. if((a == Action.RIGHT_CLICK_BLOCK)||(a == Action.RIGHT_CLICK_AIR)&&(p.getItemInHand().getTypeId() == 282)){
    11. //All errors in p.getHealth()
    12.  
    13. if(p.getHealth() != 20){
    14. p.setHealth(p.getHealth() + 6 > p.getMaxHealth() ? p.getMaxHealth() : p.getHealth() + 6);
    15. p.getItemInHand().setTypeId(281);
    16. p.getWorld().playSound(p.getLocation(), Sound.BURP, 1, 1);
    17. }
    18. }
    19.  
    20.  
    21.  
    22.  
    23.  
    24.  
    25.  
    26.  
    27.  
    28.  
    29.  
    30.  
    31.  
    32. //Kit
    33. if(a == Action.RIGHT_CLICK_BLOCK){
    34. if((e.getClickedBlock().getType().equals(Material.WALL_SIGN))||(e.getClickedBlock().getType().equals(Material.SIGN_POST))){
    35. Sign s = (Sign) e.getClickedBlock().getState();
    36. if(s.getLine(1).equalsIgnoreCase("Hero")){
    37. PlayerInventory pi = p.getInventory();
    38. pi.clear();
    39. p.setHealth(20);
    40. p.setFoodLevel(17);
    41. for (PotionEffect pe : p.getActivePotionEffects()){
    42. p.removePotionEffect(pe.getType());
    43. }
    44. ItemStack sw = new ItemStack(Material.DIAMOND_SWORD);
    45. sw.addUnsafeEnchantment(Enchantment.DAMAGE_ALL, 6);
    46. pi.addItem(sw);
    47. ItemStack h = new ItemStack(Material.DIAMOND_HELMET);
    48. ItemStack c = new ItemStack(Material.DIAMOND_CHESTPLATE);
    49. ItemStack l = new ItemStack(Material.DIAMOND_LEGGINGS);
    50. ItemStack b = new ItemStack(Material.DIAMOND_BOOTS);
    51. pi.setHelmet(h);
    52. pi.setChestplate(c);
    53. pi.setLeggings(l);
    54. pi.setBoots(b);
    55. for(int i=1;i<18;i++){
    56. pi.addItem(new ItemStack(Material.MUSHROOM_SOUP));
    57. }
    58. p.updateInventory();
    59. }
    60. }
    61. }
    62.  
    63. //Break
    64. if (a == Action.LEFT_CLICK_BLOCK){
    65. e.setCancelled(true);
    66. }
    67. }
     
  2. Offline

    CubieX

    See

    God, we really need a sticky....
    This is beeing asked and answered every few hours and no one uses the search function. :rolleyes:
     
  3. Offline

    Wolvereness Bukkit Team Member

    foodyling likes this.
Thread Status:
Not open for further replies.

Share This Page