Extra Health with Armor

Discussion in 'Plugin Development' started by MrGiGimz, Jun 17, 2014.

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

    MrGiGimz

    Hello So with this right here:

    Code:
    ItemStack Chest = new ItemStack(Material.IRON_CHESTPLATE);
    Chest.addEnchantment(Enchantment.PROTECTION_ENVIRONMENTAL, 2, true);
    
    how do i also add health to the player? The player normally has 10 hearts but with this chestplate on how do i give them 12 hearts? +2 Health basically. If anyone could help that would be awesome!
     
  2. Offline

    teej107

    thePlayer.setMaxHealth()
     
  3. Offline

    MrGiGimz

    teej107 its not a player... i want the chestplate do have that "enchantment" when you put it on you add 2 hearts how do i make the chestlpate have that attribute
     
  4. Offline

    Jogy34

  5. Offline

    xTigerRebornx

  6. Offline

    MrGiGimz

    Jogy34 and xTigerRebornx Thanks for that link but I tried to install those classes and it just gave me a ton of errors for everthing that i tried to do :( any other suggestions?
     
  7. Offline

    xTigerRebornx

    MrGiGimz What are these "errors" ?
    The only other way is to manually listen to the putting on and removing of the chestplate, which can get complicated and de-sync
     
  8. Offline

    MrGiGimz

    its hard to explain the errors as i didnt write the class for the attribute
    xTigerRebornx
     
  9. Offline

    xTigerRebornx

    MrGiGimz The errors should tell you what they are themselves.
    Simply post the errors you get?
     
  10. Offline

    teej107

    MrGiGimz When a player equips the chestplate, check and make sure it is the certain chestplate. If so, player.setMaxHealth(), else player.setMaxHealth() back to 20 or whatever the default is.

    Edit: Or give the player the health boost effect while it is epuipped.
     
  11. Offline

    Chlorek

    What's the problem to catch some events and add needed health when wearing specified item? I don't get it... You can add to current about by player.setMaxHealth(player.getMaxHealth()+4).
     
Thread Status:
Not open for further replies.

Share This Page