Heal everybody in the server?

Discussion in 'Plugin Development' started by Prophettt, Mar 6, 2013.

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

    Prophettt

    Hello,

    Since I'm newby at making java plugins, and saw this before, and can't seem to find it anywhere I'm asking it here.

    How do you heal everybody in the server at ones, with the command being like:
    /heal *
    Since '*' means everybody.
     
  2. Offline

    frozenpoptartmc

    you could just make it /heal
    Code:java
    1.  
    2. if(commandLabel.equalsIgnoreCase("heal"){
    3. for(Player everybody = Bukkit.getServer().getOnlinePlayers()){
    4. everybody.setHealth(20);
    5. }
    6. }
    7.  
     
  3. Offline

    xmarinusx

    Don't you have to use a ":" instead of a "=" in a for loop? Not 100% sure.
     
  4. Offline

    minoneer

    xmarinusx You are correct.
    frozenpoptartmc Prophettt "=" won't work, use ":" instead :)
     
  5. Offline

    eamon12

  6. Offline

    zack6849

    Code:
    for(Player p : Bukkit.getServer().getOnlinePlayers()){
      p.setHealth(20);
    }
    
     
  7. Offline

    Lecrayen

    solved :)
     
Thread Status:
Not open for further replies.

Share This Page