Set a Gamemode

Discussion in 'Spigot Plugin Development' started by maxouland1, May 22, 2015.

  1. Hello,
    I code a mini- game plugin. But I do not know how to set the gamemode (Adventure) and keep people from regenerate life (HardCore). I tested a lot of things but I can not find.
    Can you help me ?
    Thank you ^^
     
  2. (Player object).setGameMode(GameMode.ADVENTURE);

    Then listen to the PlayerDamageEvent and set heath to 20
     
  3. Thank you, but for the regeneration ?
     
  4. Code (Text):
    player.setGameMode(GameMode.ADVENTURE);
    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "gamerule doNaturalRegeneration false");
     
  5. Thank you :D
     
  6. :D
     
  7. I'd use this instead :p
     
    • Agree Agree x 3
  8. Oh, I didn't know that existed :p
     
  9. Sorry but I want protect the block of the explosion.
    How to do ?
     
  10. Use the Javadocs.
     
    • Like Like x 1
    • Winner Winner x 1