block break event

Discussion in 'Plugin Development' started by creppii, Feb 10, 2014.

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

    creppii

    hey guys
    i wanna make a plugin to protect the whole world from Block breaking...
    how can i disable block breaking?
    maybe with block breaking event and then respawn the block?

    thanks for ur help :)
     
  2. Offline

    IkBenHarm

    use the brockbrealevent and then simply event.setCancelled(true);
     
    AcpSoldier likes this.
  3. IkBenHarm means "BlockBreakEvent". I'm not sure if he was joking...

    Also, in the BlockBreakEvent you must check if the player is in that world.
    Code:
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        if (event.getPlayer().getWorld().getName().equalsIgnoreCase("WORLD_NAME")) event.setCancelled(true);
    }
    
     
  4. Offline

    MrAwellstein

    You could just set everyone in that world to Adventure Mode. Like have the default gamerule for gamemode be set for adventure. If you do that, when they warp into the world, they will be set automatically to not be able to break blocks, and you don't have to worry about extra code for ignored instances for builders.
     
  5. Offline

    IkBenHarm

    KingFaris11
    oh man, I must be dyslectic or something
     
  6. Offline

    Maurdekye

    MrAwellstein Yeah, but in the current MC build adventure mode players can still break some blocks, like glass and redstone.
     
  7. Offline

    MrAwellstein

    Really? I thought they couldn't break anything at all o.o
     
Thread Status:
Not open for further replies.

Share This Page