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
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); }
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.
MrAwellstein Yeah, but in the current MC build adventure mode players can still break some blocks, like glass and redstone.