How cancel the event of braking a block

Discussion in 'Plugin Development' started by luigieai, Dec 22, 2013.

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

    luigieai

    How i cancel the event of braking a block?
    im making a plugin that when a player has a permission he cant break the blocks of the world, i know the name of event (BlockBreakEvent) but i dont know how to do it
     
  2. Offline

    amhokies

  3. Offline

    luigieai

    amhokies
    i know about event, but how i do this, i forget the name to cancel the event
    Code:java
    1. @EventHandler
    2. public void b (BlockBreakEvent e){
    3. final Player p = e.getPlayer();
    4. if (p.hasPermission("break.cant.break")){
    5. // what i do here?
    6. }
    7. }
    8. }
     
  4. Offline

    BeaztX

    e.setCancelled(true); :)

    Also makes more sense if you check: if(!p.hasPermission("permission") {

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 5, 2016
  5. Offline

    luigieai

Thread Status:
Not open for further replies.

Share This Page