From 23766f20dd94d579dcfbad6fc57f250c4fa2caa8 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Fri, 7 Jun 2013 14:33:58 +0200 Subject: [PATCH] Transformed the BlockFadeEvent handler into a switch. --- .../worldguard/bukkit/WorldGuardBlockListener.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java index 69f4c7d8..6958b367 100644 --- a/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java +++ b/src/main/java/com/sk89q/worldguard/bukkit/WorldGuardBlockListener.java @@ -816,30 +816,32 @@ public void onBlockFade(BlockFadeEvent event) { ConfigurationManager cfg = plugin.getGlobalStateManager(); WorldConfiguration wcfg = cfg.get(event.getBlock().getWorld()); - int type = event.getBlock().getTypeId(); - - if (type == BlockID.ICE) { + switch (event.getBlock().getTypeId()) { + case BlockID.ICE: if (wcfg.disableIceMelting) { event.setCancelled(true); return; } + if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows( DefaultFlag.ICE_MELT, event.getBlock().getLocation())) { event.setCancelled(true); return; } - } + break; - if (type == BlockID.SNOW) { + case BlockID.SNOW: if (wcfg.disableSnowMelting) { event.setCancelled(true); return; } + if (wcfg.useRegions && !plugin.getGlobalRegionManager().allows( DefaultFlag.SNOW_MELT, event.getBlock().getLocation())) { event.setCancelled(true); return; } + break; } if (type == BlockID.SOIL) {