Only being able to place blocks

Discussion in 'Plugin Development' started by MrLizardDogMan, Mar 22, 2014.

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

    MrLizardDogMan

    Hello, I want to add a feature to my plugin that will only let players place blocks, but not destroy them. So that TNT is the only way to break blocks. How would i do this?
     
  2. Offline

    xMrPoi

    Get the PlayerBlockBreakEvent and cancel it.
     
  3. Offline

    Plo124

    ^^ Do this by adding an EventHandler, making sure the event is registered, put
    Code:java
    1. @EventHandler
    2. public void blockBreakEvent(BlockBreakEvent e){
    3. if (e.getPlayer().getGamemode() == GameMode.SURVIVAL){
    4. e.setCancelled(true);
    5. }
    6. }
     
  4. Offline

    phildachil

    Create an ArrayList, and use a blockBreakEvent, if the arraylist contains the players name, he can't break blocks.
     
Thread Status:
Not open for further replies.

Share This Page