Info needed pls

Discussion in 'Plugin Development' started by oldCOBOLprogrammer, Mar 19, 2020.

  1. Hi

    Ive been dragged into helping my grandson. Hes trying to build a minecraft server, and has hit a problem. Now, i havent written program code since i wrote C cak in 1995, so i have no idea what im doing (althoung java is ofc just C++ in fancy clothes).

    Heres the problem. In game you can make armour (Minetinker) that gives you 25 hearts health. He has tried various health plugins, but each one fails to restore 25 hearts health - in only gives you 11 hearts. We'e tried a couple of different plugins, they all fail. However, you can set full health with the ingame commade
    /effect give @p minecraft:instanthealth 100

    So in the absence of beaing about to figure out why /heal doesnt work, the alternative is to write a plugin that does the same as /effect give @p minecraft:instanthealth 100.

    So how would the java line that does that be written? What is the player data instance that sets this?
     
    Last edited: Mar 19, 2020
  2. Offline

    timtower Moderator Moderator

    @oldCOBOLprogrammer If you have a Player (or any LivingEntity) then you can get the health and add 100 to it (while not overshooting the max health)
    Then you set the health
     
  3. yes, but what is the player data item to set, and whats the correct syntax - is it something like

    player.setHealth{{short}0} ?
     
  4. Offline

    timtower Moderator Moderator

    I don't know how you want to set it.
    Don't know if you want to use events, commands or that it will get called by a different function.
     

Share This Page