getHealth()

Discussion in 'Plugin Development' started by Deleted user, Jul 31, 2013.

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

    daboross

    local? What do you mean by that?
     
  2. Offline

    Deleted user

    daboross
    Here's the code:
    Code:java
    1. if (helmet == null) {
    2. String hName = "Air";
    3. } else {
    4. String hName = WordUtils
    5. .capitalizeFully(helmet.getType()
    6. .toString()
    7. .replaceAll("_", " ")); }
    8.  
    9. player.sendMessage(
    10. + ChatColor.AQUA + "Helmet: " + ChatColor.GREEN +"Type: " + ChatColor.DARK_RED + hName);


    It won't work...
     
  3. Offline

    daboross

    If you declare 'String hName;' without assigning a value right before 'if (helmet == null) {' then you can access it outside of the if statement.
    Also because you already declared it you would use 'hName = <x>' instead of 'String hName = <x>' inside the if and else statements.
     
  4. Offline

    Deleted user

    daboross So I should declare all variables first...Thanks
     
  5. Offline

    daboross

    You're welcome!
     
  6. JHG0
    I'm not sure if your question's been answered but:
    Code:
    item.getType().getMaxDurability()
     
  7. Offline

    Deleted user

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

Share This Page