Solved What for code do i need?

Discussion in 'Plugin Development' started by martinke123, May 30, 2014.

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

    martinke123

    I am making my own hub plugin atm. but i cant come up whit 1 thing that if the player comes online get healed in a loop and feeded in a loop.
     
  2. Offline

    Konkz

    You need no loops. Listen to PlayerJoinEvent then get the Player from that event using
    Player bukkitPlayer = event.getPlayer(); and simply set their health to 20 (as 20 is max) by doing
    bukkitPlayer.setHealth(20.0) - Take note that it takes a double whereas setFoodLevel takes an int.
    To set food: bukkitPlayer.setFood(20)
     
Thread Status:
Not open for further replies.

Share This Page