Code: @EventHandler public void onBlockBreak(BlockBreakEvent e) { RegionManager set = wg.getRegionManager(e.getPlayer().getWorld()); Material block = e.getBlock().getType(); Player p = e.getPlayer(); drops = 1; if (p.getGameMode()== GameMode.CREATIVE)return; if(set.hasRegion("Walls")){ if(block == Material.SPRUCE_SLAB){ } } Spruce slab isn;t working. My plugin is stopping worldguard and I'm wondering how I could prevent it from stopping WorldGuard. Are there any other ways of doing it? I need to block: Spruce Fence, Spruce Slab, Spruce Planks, Smooth Brick stairs, Smooth Brick slab, Smooth Brick, Glow Stone, Blue Hardened Clay, and Purple Hardened Clay and Signs
That would be because you don't ignore cancelled events. Or even check if they are cancelled already.
Code: s switch (block) { case SPRUCE_FENCE: e.setCancelled(true); return; case SMOOTH_STAIRS: e.setCancelled(true); return; case GLOWSTONE: e.setCancelled(true); return; case SIGN: e.setCancelled(true); case HARD_CLAY: case e.getBlock().getData() == (byte) 11: return; How could I make this work? I don't want to change my entire system to using if statements and am wondering if there is a way to make this work. I don't think it works because the switch is a material but i want to check the data for blue stained clay
@Nutowen Nested statements are needed though. Or you make a list of MaterialData, check the type and data, if same: cancel event. You can do that in a loop