diff --git a/src/com/massivecraft/factions/engine/EngineExploit.java b/src/com/massivecraft/factions/engine/EngineExploit.java index 5dc683ea..f24e2ee5 100644 --- a/src/com/massivecraft/factions/engine/EngineExploit.java +++ b/src/com/massivecraft/factions/engine/EngineExploit.java @@ -22,6 +22,7 @@ import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import java.util.ArrayList; import java.util.HashMap; import java.util.List; +import java.util.Set; import java.util.UUID; public class EngineExploit extends Engine @@ -37,7 +38,6 @@ public class EngineExploit extends Engine // OBSIDIAN GENERATORS // -------------------------------------------- // - @SuppressWarnings("deprecation") @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void obsidianGenerators(BlockFromToEvent event) { @@ -45,9 +45,9 @@ public class EngineExploit extends Engine // thanks to ObGenBlocker and WorldGuard for this method Block block = event.getToBlock(); - int source = event.getBlock().getTypeId(); - int target = block.getTypeId(); - if ((target == 55 || target == 132) && (source == 0 || source == 10 || source == 11)) + Material source = event.getBlock().getType(); + Material target = block.getType(); + if ((target == Material.REDSTONE_WIRE || target == Material.TRIPWIRE) && (source == Material.AIR || source == Material.LAVA || source == Material.STATIONARY_LAVA)) { block.setType(Material.AIR); } @@ -103,7 +103,8 @@ public class EngineExploit extends Engine // But this optional change below provides workaround for waterwalling providing perfect protection, // and makes cheap (non-obsidian) TNT cannons require minor maintenance between shots. - @SuppressWarnings("deprecation") + private static final Set blastProtected = MUtil.set(Material.AIR, Material.WATER, Material.STATIONARY_WATER, Material.LAVA, Material.STATIONARY_LAVA, Material.OBSIDIAN, Material.PORTAL, Material.ENCHANTMENT_TABLE, Material.ENDER_PORTAL, Material.ENDER_PORTAL_FRAME, Material.ENDER_CHEST); + @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) public void tntWaterlog(EntityExplodeEvent event) { @@ -123,12 +124,10 @@ public class EngineExploit extends Engine targets.add(center.getRelative(-1, 0, 0)); for (Block target : targets) { - int id = target.getTypeId(); + Material id = target.getType(); // ignore air, bedrock, water, lava, obsidian, enchanting table, etc.... too bad we can't get a blast resistance value through Bukkit yet - if (id != 0 && (id < 7 || id > 11) && id != 49 && id != 90 && id != 116 && id != 119 && id != 120 && id != 130) - { - target.breakNaturally(); - } + if (blastProtected.contains(id)) continue; + target.breakNaturally(); } }