[SOLVED] Advanced Config

Discussion in 'Plugin Development' started by kaZep, Jul 27, 2012.

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

    kaZep

    Hello everyone, i want to make an configurable command, or more precise, and advanced config. I'll give you an example:

    Code:
    if(cmd.getName().equalsIgnoreCase("heal")){
      if(args.length == 0){
          player.sendMessage("/heal <player>");
      }else if(args.length == 1){
          player.setHealth(getConfig().getString("heal-ammount"));
      }
    }
    Ok, in this command i want to make an configurable heal ammount. Please help me to do that. It's an example.
     
  2. Offline

    np98765

    So in the config, type "heal-amount: 10". Then, /heal <player> will heal them 5 hearts. :)
     
  3. Offline

    kaZep

    np98765 i'm getting an error, from 'setHealth'...
    ERROR: The method setHealth(int) in the type LivingEntity is not applicable for the arguments (String)
     
  4. Offline

    xboxnolifes

    make sure in the config you are saving the "heal-amount" value as an integer and not a string. Otherwise, I don't know what's wrong.
     
  5. Offline

    theguynextdoor

    Use getConfig().getInt("heal-amount") and be sure it is saved as an int
     
  6. Offline

    PandazNWafflez

    Type getInt("heal-amount") not getString("heal-amount")
     
  7. Offline

    kaZep

  8. Offline

    russjr08

    You gave it a string, and it requires an int.

    Edit: Aww I got ninja'd
     
Thread Status:
Not open for further replies.

Share This Page