diff --git a/src/com/projectkorra/ProjectKorra/Methods.java b/src/com/projectkorra/ProjectKorra/Methods.java index 9ab5414d..e1382afd 100644 --- a/src/com/projectkorra/ProjectKorra/Methods.java +++ b/src/com/projectkorra/ProjectKorra/Methods.java @@ -8,6 +8,7 @@ import java.util.Collection; import java.util.HashMap; import java.util.HashSet; import java.util.List; +import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; @@ -61,6 +62,7 @@ import com.projectkorra.ProjectKorra.waterbending.FreezeMelt; import com.projectkorra.ProjectKorra.waterbending.WaterManipulation; import com.projectkorra.ProjectKorra.waterbending.WaterSpout; import com.sk89q.worldguard.bukkit.WorldGuardPlugin; +import com.sk89q.worldguard.protection.flags.DefaultFlag; public class Methods { @@ -69,7 +71,7 @@ public class Methods { public Methods(ProjectKorra plugin) { Methods.plugin = plugin; } - + private static boolean allowharmless = plugin.getConfig().getBoolean("Properties.RegionProtection.AllowHarmlessAbilities"); private static boolean respectWorldGuard = plugin.getConfig().getBoolean("Properties.RegionProtection.RespectWorldGuard"); private static boolean respectPreciousStones = plugin.getConfig().getBoolean("Properties.RegionProtection.RespectPreciousStones"); @@ -301,13 +303,16 @@ public class Methods { if (isEarthAbility(ability) && !isBender(player, Element.Earth)) return false; if (isFireAbility(ability) && !isBender(player, Element.Fire)) return false; if (isChiAbility(ability) && !isBender(player, Element.Chi)) return false; + if (isRegionProtectedFromBuild(p, ability, p.getLocation())) return false; return true; } public static boolean canBendPassive(String player, Element element) { BendingPlayer bPlayer = getBendingPlayer(player); + Player p = Bukkit.getPlayer(player); if (!bPlayer.isToggled) return false; if (!bPlayer.hasElement(element)) return false; + if (isRegionProtectedFromBuild(p, null, p.getLocation())) return false; return true; } @@ -422,12 +427,39 @@ public class Methods { } public static boolean isEarthbendable(Player player, Block block) { + return isEarthbendable(player, "RaiseEarth", block); + } + + public static boolean isEarthbendable(Player player, String ability, + Block block) { + if (isRegionProtectedFromBuild(player, ability, + block.getLocation())) + return false; Material material = block.getType(); - for (String s: plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks")) { + // if ((material == Material.STONE) || (material == Material.CLAY) + // || (material == Material.COAL_ORE) + // || (material == Material.DIAMOND_ORE) + // || (material == Material.DIRT) + // || (material == Material.GOLD_ORE) + // || (material == Material.GRASS) + // || (material == Material.GRAVEL) + // || (material == Material.IRON_ORE) + // || (material == Material.LAPIS_ORE) + // || (material == Material.NETHERRACK) + // || (material == Material.REDSTONE_ORE) + // || (material == Material.SAND) + // || (material == Material.SANDSTONE)) { + // return true; + // } + for (String s : ProjectKorra.plugin.getConfig().getStringList("Properties.Earth.EarthbendableBlocks")) { + if (material == Material.getMaterial(s)) { + return true; + } + } return false; } @@ -489,7 +521,16 @@ public class Methods { } public static boolean isTransparentToEarthbending(Player player, Block block) { - if (Arrays.asList(transparentToEarthbending).contains(block.getTypeId())) return true; + return isTransparentToEarthbending(player, "RaiseEarth", block); + } + + public static boolean isTransparentToEarthbending(Player player, + String ability, Block block) { + if (isRegionProtectedFromBuild(player, ability, + block.getLocation())) + return false; + if (Arrays.asList(transparentToEarthbending).contains(block.getTypeId())) + return true; return false; } @@ -525,9 +566,9 @@ public class Methods { for (double i = 0; i <= range; i++) { Block block = location.clone().add(vector.clone().multiply(i)) .getBlock(); - // if (isRegionProtectedFromBuild(player, Abilities.RaiseEarth, - // location)) - // continue; + if (isRegionProtectedFromBuild(player, "RaiseEarth", + location)) + continue; if (isEarthbendable(player, block)) { return block; } @@ -565,9 +606,9 @@ public class Methods { for (double i = 0; i <= range; i++) { Block block = location.clone().add(vector.clone().multiply(i)) .getBlock(); - // if (isRegionProtectedFromBuild(player, Abilities.WaterManipulation, - // location)) - // continue; + if (isRegionProtectedFromBuild(player, "WaterManipulation", + location)) + continue; if (isWaterbendable(block, player) && (!isPlant(block) || plantbending)) { if (TempBlock.isTempBlock(block)) { @@ -843,9 +884,9 @@ public class Methods { public static boolean moveEarth(Player player, Block block, Vector direction, int chainlength, boolean throwplayer) { - if (isEarthbendable(player, block)) { - // && !isRegionProtectedFromBuild(player, Abilities.RaiseEarth, - // block.getLocation())) { + if (isEarthbendable(player, block) + && !isRegionProtectedFromBuild(player, "RaiseEarth", + block.getLocation())) { boolean up = false; boolean down = false; @@ -1191,7 +1232,7 @@ public class Methods { return faces[besti]; } - + public static boolean isHarmlessAbility(String ability) { return Arrays.asList(AbilityModuleManager.harmlessabilities).contains(ability); } @@ -1201,11 +1242,11 @@ public class Methods { Set ignite = AbilityModuleManager.igniteabilities; Set explode = AbilityModuleManager.explodeabilities; -// List ignite = new ArrayList(); -// ignite.add(Abilities.Blaze); -// List explode = new ArrayList(); -// explode.add(Abilities.FireBlast); -// explode.add(Abilities.Lightning); + // List ignite = new ArrayList(); + // ignite.add(Abilities.Blaze); + // List explode = new ArrayList(); + // explode.add(Abilities.FireBlast); + // explode.add(Abilities.Lightning); if (ability == null && allowharmless) return false; @@ -1272,17 +1313,16 @@ public class Methods { if (psp != null && respectPreciousStones) { PreciousStones ps = (PreciousStones) psp; -// if (ignite.contains(ability)) { -// if (ps.getForceFieldManager().hasSourceField(location, -// FieldFlag.PREVENT_FIRE)) -// return true; -// } - -// if (explode.contains(ability)) { -// if (ps.getForceFieldManager().hasSourceField(location, -// FieldFlag.PREVENT_EXPLOSIONS)) -// return true; -// } + if (ignite.contains(ability)) { + if (ps.getForceFieldManager().hasSourceField(location, + FieldFlag.PREVENT_FIRE)) + return true; + } + if (explode.contains(ability)) { + if (ps.getForceFieldManager().hasSourceField(location, + FieldFlag.PREVENT_EXPLOSIONS)) + return true; + } if (ps.getForceFieldManager().hasSourceField(location, FieldFlag.PREVENT_PLACE)) @@ -1290,13 +1330,13 @@ public class Methods { } if (fcp != null && mcore != null && respectFactions) { -// if (ignite.contains(ability)) { -// -// } -// -// if (explode.contains(ability)) { -// -// } + if (ignite.contains(ability)) { + + } + + if (explode.contains(ability)) { + + } if (!FactionsListenerMain.canPlayerBuildAt(player, PS.valueOf(loc.getBlock()), false)) { @@ -1324,13 +1364,13 @@ public class Methods { location, 3, (byte) 0, TownyPermission.ActionType.BUILD); -// if (ignite.contains(ability)) { -// -// } -// -// if (explode.contains(ability)) { -// -// } + if (ignite.contains(ability)) { + + } + + if (explode.contains(ability)) { + + } if (!bBuild) { PlayerCache cache = twn.getCache(player); diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java index fe71222a..54d6c9be 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirBlast.java @@ -132,9 +132,9 @@ public class AirBlast { || Methods.isSolid(location.getBlock())) return; -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirBlast, -// location)) -// return; + if (Methods.isRegionProtectedFromBuild(player, "AirBlast", + location)) + return; if (origins.containsKey(player)) { origins.replace(player, location); @@ -149,11 +149,11 @@ public class AirBlast { return false; } -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirBlast, -// location)) { -// instances.remove(id); -// return false; -// } + if (Methods.isRegionProtectedFromBuild(player, "AirBlast", + location)) { + instances.remove(id); + return false; + } speedfactor = speed * (ProjectKorra.time_step / 1000.); diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java b/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java index c5288683..7f88b141 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirBubble.java @@ -79,9 +79,9 @@ public class AirBubble { for (Block block : Methods.getBlocksAroundPoint(location, radius)) { if (waterorigins.containsKey(block)) continue; -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirBubble, -// block.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "AirBubble", + block.getLocation())) + continue; if (block.getType() == Material.STATIONARY_WATER || block.getType() == Material.WATER) { if (WaterManipulation.canBubbleWater(block)) { diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java b/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java index b9a9c16e..d4d34620 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirScooter.java @@ -75,11 +75,11 @@ public class AirScooter { return; } -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirScooter, -// player.getLocation())) { -// remove(); -// return; -// } + if (Methods.isRegionProtectedFromBuild(player, "AirScooter", + player.getLocation())) { + remove(); + return; + } // if (Methods // .isSolid(player diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirShield.java b/src/com/projectkorra/ProjectKorra/airbending/AirShield.java index 96973351..6d6a1ffe 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirShield.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirShield.java @@ -54,9 +54,9 @@ public class AirShield { FireBlast.removeFireBlastsAroundPoint(origin, radius); for (Entity entity : Methods.getEntitiesAroundPoint(origin, radius)) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirShield, -// entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "AirShield", + entity.getLocation())) + continue; if (origin.distance(entity.getLocation()) > 2) { double x, z, vx, vz, mag; double angle = 50; @@ -103,10 +103,10 @@ public class AirShield { z = origin.getZ() + radius * Math.sin(angle) * f; Location effect = new Location(origin.getWorld(), x, y, z); - // if (!Methods.isRegionProtectedFromBuild(player, Abilities.AirShield, - // effect)) - origin.getWorld().playEffect(effect, Effect.SMOKE, 4, - (int) AirBlast.defaultrange); + if (!Methods.isRegionProtectedFromBuild(player, "AirShield", + effect)) + origin.getWorld().playEffect(effect, Effect.SMOKE, 4, + (int) AirBlast.defaultrange); angles.put(i, angles.get(i) + (int) (10 * speedfactor)); } @@ -125,18 +125,18 @@ public class AirShield { instances.remove(player.getEntityId()); return false; } -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirShield, -// player.getLocation())) { -// instances.remove(player.getEntityId()); -// return false; -// } + if (Methods.isRegionProtectedFromBuild(player, "AirShield", + player.getLocation())) { + instances.remove(player.getEntityId()); + return false; + } speedfactor = 1; if (!Methods.canBend(player.getName(), "AirShield") || player.getEyeLocation().getBlock().isLiquid()) { instances.remove(player.getEntityId()); return false; } - + if (Methods.getBoundAbility(player) == null) { instances.remove(player.getEntityId()); return false; diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java b/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java index ce9f1c95..19bc432c 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSuction.java @@ -120,7 +120,7 @@ public class AirSuction { Location location = origin.clone(); for (double i = 1; i <= range; i++) { location = origin.clone().add(direction.clone().multiply(i)); - if (!Methods.isTransparentToEarthbending(player, location.getBlock())) { + if (!Methods.isTransparentToEarthbending(player, location.getBlock()) || Methods.isRegionProtectedFromBuild(player, "AirSuction", location)) { return origin.clone().add(direction.clone().multiply(i - 1)); } } @@ -133,10 +133,10 @@ public class AirSuction { if (location.getBlock().isLiquid() || Methods.isSolid(location.getBlock())) return; -// -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirSuction, -// location)) -// return; + + if (Methods.isRegionProtectedFromBuild(player, "AirSuction", + location)) + return; if (origins.containsKey(player)) { origins.replace(player, location); @@ -150,11 +150,11 @@ public class AirSuction { instances.remove(id); return false; } -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirSuction, -// location)) { -// instances.remove(id); -// return false; -// } + if (Methods.isRegionProtectedFromBuild(player, "AirSuction", + location)) { + instances.remove(id); + return false; + } speedfactor = speed * (ProjectKorra.time_step / 1000.); ticks++; diff --git a/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java b/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java index fa6787b7..4cd50ef3 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java +++ b/src/com/projectkorra/ProjectKorra/airbending/AirSwipe.java @@ -183,7 +183,7 @@ public class AirSwipe { direction.clone().multiply(speedfactor)); elements.replace(direction, location); - if (location.distance(origin) > range) { + if (location.distance(origin) > range || Methods.isRegionProtectedFromBuild(player, "AirSwipe", location)) { elements.remove(direction); } else { Methods.removeSpouts(location, player); @@ -246,9 +246,9 @@ public class AirSwipe { Methods.removeSpouts(location, player); for (Entity entity : Methods.getEntitiesAroundPoint(location, affectingradius)) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.AirSwipe, -// entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "AirSwipe", + entity.getLocation())) + continue; if (entity.getEntityId() != player.getEntityId()) { if (AvatarState.isAvatarState(player)) { entity.setVelocity(direction.multiply(AvatarState diff --git a/src/com/projectkorra/ProjectKorra/airbending/Tornado.java b/src/com/projectkorra/ProjectKorra/airbending/Tornado.java index e39747c8..9221164e 100644 --- a/src/com/projectkorra/ProjectKorra/airbending/Tornado.java +++ b/src/com/projectkorra/ProjectKorra/airbending/Tornado.java @@ -20,7 +20,7 @@ public class Tornado { public static ConcurrentHashMap instances = new ConcurrentHashMap(); static FileConfiguration config = ProjectKorra.plugin.getConfig(); - + private static double maxradius = config.getDouble("Abilities.Air.Tornado.Radius"); private static double maxheight = config.getDouble("Abilities.Air.Tornado.Height"); private static double range = config.getDouble("Abilities.Air.Tornado.Range"); @@ -85,11 +85,11 @@ public class Tornado { return false; } -// if (Methods -// .isRegionProtectedFromBuild(player, Abilities.AirBlast, origin)) { -// instances.remove(player.getEntityId()); -// return false; -// } + if (Methods + .isRegionProtectedFromBuild(player, "AirBlast", origin)) { + instances.remove(player.getEntityId()); + return false; + } rotateTornado(); return true; } @@ -104,9 +104,9 @@ public class Tornado { origin.setY(origin.getY() - 1. / 10. * height); for (Entity entity : Methods.getEntitiesAroundPoint(origin, height)) { -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.AirBlast, entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "AirBlast", entity.getLocation())) + continue; double y = entity.getLocation().getY(); double factor; if (y > origin.getY() && y < origin.getY() + height) { @@ -180,10 +180,10 @@ public class Tornado { * Math.sin(angle); Location effect = new Location(origin.getWorld(), x, y, z); - // if (!Methods.isRegionProtectedFromBuild(player, - // Abilities.AirBlast, effect)) - origin.getWorld().playEffect(effect, Effect.SMOKE, 4, - (int) AirBlast.defaultrange); + if (!Methods.isRegionProtectedFromBuild(player, + "AirBlast", effect)) + origin.getWorld().playEffect(effect, Effect.SMOKE, 4, + (int) AirBlast.defaultrange); angles.put(i, angles.get(i) + 25 * (int) speedfactor); } diff --git a/src/com/projectkorra/ProjectKorra/earthbending/EarthBlast.java b/src/com/projectkorra/ProjectKorra/earthbending/EarthBlast.java index 5d4569af..33709a9b 100644 --- a/src/com/projectkorra/ProjectKorra/earthbending/EarthBlast.java +++ b/src/com/projectkorra/ProjectKorra/earthbending/EarthBlast.java @@ -371,9 +371,9 @@ public class EarthBlast { for (Entity entity : Methods.getEntitiesAroundPoint(location, FireBlast.affectingradius)) { -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.EarthBlast, entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "EarthBlast", entity.getLocation())) + continue; if (entity instanceof LivingEntity && (entity.getEntityId() != player.getEntityId() || hitself)) { // Block testblock = location.getBlock(); @@ -507,9 +507,9 @@ public class EarthBlast { if (!blast.location.getWorld().equals(player.getWorld())) continue; -// if (Methods.isRegionProtectedFromBuild(player, Abilities.EarthBlast, -// blast.location)) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "EarthBlast", + blast.location)) + continue; if (blast.player.equals(player)) blast.redirect(player, getTargetLocation(player)); @@ -553,9 +553,9 @@ public class EarthBlast { if (!blast.progressing) continue; -// if (Methods.isRegionProtectedFromBuild(player, Abilities.EarthBlast, -// blast.location)) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "EarthBlast", + blast.location)) + continue; Location location = player.getEyeLocation(); Vector vector = location.getDirection(); diff --git a/src/com/projectkorra/ProjectKorra/earthbending/Tremorsense.java b/src/com/projectkorra/ProjectKorra/earthbending/Tremorsense.java index 20c49078..b5b3d9d3 100644 --- a/src/com/projectkorra/ProjectKorra/earthbending/Tremorsense.java +++ b/src/com/projectkorra/ProjectKorra/earthbending/Tremorsense.java @@ -72,9 +72,9 @@ public class Tremorsense { Block blocki = block.getRelative(BlockFace.EAST, i) .getRelative(BlockFace.NORTH, j) .getRelative(BlockFace.DOWN, k); -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.RaiseEarth, blocki.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "RaiseEarth", blocki.getLocation())) + continue; if (Methods.isEarthbendable(player, blocki) && !earth) { earth = true; diff --git a/src/com/projectkorra/ProjectKorra/firebending/Extinguish.java b/src/com/projectkorra/ProjectKorra/firebending/Extinguish.java index 91ec0bb3..012ee594 100644 --- a/src/com/projectkorra/ProjectKorra/firebending/Extinguish.java +++ b/src/com/projectkorra/ProjectKorra/firebending/Extinguish.java @@ -40,9 +40,9 @@ public class Extinguish { player.getWorld()); for (Block block : Methods.getBlocksAroundPoint( player.getTargetBlock(null, (int) range).getLocation(), radius)) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.Blaze, -// block.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "Blaze", + block.getLocation())) + continue; if (block.getType() == Material.FIRE) { block.setType(Material.AIR); block.getWorld().playEffect(block.getLocation(), diff --git a/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java b/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java index 114487d0..436141c1 100644 --- a/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java +++ b/src/com/projectkorra/ProjectKorra/firebending/FireBlast.java @@ -120,10 +120,10 @@ public class FireBlast { return false; } -// if (Methods.isRegionProtectedFromBuild(player, Abilities.Blaze, location)) { -// instances.remove(id); -// return false; -// } + if (Methods.isRegionProtectedFromBuild(player, "Blaze", location)) { + instances.remove(id); + return false; + } speedfactor = speed * (ProjectKorra.time_step / 1000.); diff --git a/src/com/projectkorra/ProjectKorra/firebending/FireShield.java b/src/com/projectkorra/ProjectKorra/firebending/FireShield.java index 33ab13bb..e941b4d2 100644 --- a/src/com/projectkorra/ProjectKorra/firebending/FireShield.java +++ b/src/com/projectkorra/ProjectKorra/firebending/FireShield.java @@ -22,7 +22,7 @@ public class FireShield { private static ConcurrentHashMap instances = new ConcurrentHashMap(); private static Map cooldowns = new HashMap(); - + private static long interval = 100; private static double radius = 3; private static double discradius = 1.5; @@ -110,17 +110,17 @@ public class FireShield { } for (Block block : blocks) { -// if (!Methods.isRegionProtectedFromBuild(player, -// Abilities.FireShield, block.getLocation())) + if (!Methods.isRegionProtectedFromBuild(player, + "FireShield", block.getLocation())) block.getWorld().playEffect(block.getLocation(), Effect.MOBSPAWNER_FLAMES, 0, 20); } for (Entity entity : Methods.getEntitiesAroundPoint(location, radius)) { -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.FireShield, entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "FireShield", entity.getLocation())) + continue; if (player.getEntityId() != entity.getEntityId() && ignite) { entity.setFireTicks(120); new Enflamed(entity, player); @@ -139,11 +139,11 @@ public class FireShield { Vector direction = location.getDirection(); location = location.clone().add(direction.multiply(radius)); -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.FireShield, location)) { -// remove(); -// return; -// } + if (Methods.isRegionProtectedFromBuild(player, + "FireShield", location)) { + remove(); + return; + } for (double theta = 0; theta < 360; theta += 20) { Vector vector = Methods.getOrthogonalVector(direction, theta, @@ -157,17 +157,17 @@ public class FireShield { } for (Block block : blocks) { -// if (!Methods.isRegionProtectedFromBuild(player, -// Abilities.FireShield, block.getLocation())) - block.getWorld().playEffect(block.getLocation(), - Effect.MOBSPAWNER_FLAMES, 0, 20); + if (!Methods.isRegionProtectedFromBuild(player, + "FireShield", block.getLocation())) + block.getWorld().playEffect(block.getLocation(), + Effect.MOBSPAWNER_FLAMES, 0, 20); } for (Entity entity : Methods.getEntitiesAroundPoint(location, discradius)) { -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.FireShield, entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "FireShield", entity.getLocation())) + continue; if (player.getEntityId() != entity.getEntityId() && ignite) { entity.setFireTicks(120); if (!(entity instanceof LivingEntity)) { diff --git a/src/com/projectkorra/ProjectKorra/firebending/Fireball.java b/src/com/projectkorra/ProjectKorra/firebending/Fireball.java index 26186f55..96333ad8 100644 --- a/src/com/projectkorra/ProjectKorra/firebending/Fireball.java +++ b/src/com/projectkorra/ProjectKorra/firebending/Fireball.java @@ -100,11 +100,11 @@ public class Fireball { if (System.currentTimeMillis() > time + interval) { if (launched) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.Blaze, -// location)) { -// remove(); -// return; -// } + if (Methods.isRegionProtectedFromBuild(player, "Blaze", + location)) { + remove(); + return; + } } time = System.currentTimeMillis(); @@ -198,11 +198,11 @@ public class Fireball { // Methods.verbose("Fireball Explode!"); boolean explode = true; for (Block block : Methods.getBlocksAroundPoint(location, 3)) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.FireBlast, -// block.getLocation())) { -// explode = false; -// break; -// } + if (Methods.isRegionProtectedFromBuild(player, "FireBlast", + block.getLocation())) { + explode = false; + break; + } } if (explode) { explosion = player.getWorld().spawn(location, TNTPrimed.class); diff --git a/src/com/projectkorra/ProjectKorra/firebending/Lightning.java b/src/com/projectkorra/ProjectKorra/firebending/Lightning.java index ae4954ef..4aec07b1 100644 --- a/src/com/projectkorra/ProjectKorra/firebending/Lightning.java +++ b/src/com/projectkorra/ProjectKorra/firebending/Lightning.java @@ -54,11 +54,11 @@ public class Lightning { Location targetlocation = getTargetLocation(); if (AvatarState.isAvatarState(player)) maxdamage = AvatarState.getValue(maxdamage); -// if (!Methods.isRegionProtectedFromBuild(player, Abilities.Lightning, -// targetlocation)) { + if (!Methods.isRegionProtectedFromBuild(player, "Lightning", + targetlocation)) { strike = player.getWorld().strikeLightning(targetlocation); strikes.put(strike, this); -// } + } instances.remove(player); } diff --git a/src/com/projectkorra/ProjectKorra/firebending/WallOfFire.java b/src/com/projectkorra/ProjectKorra/firebending/WallOfFire.java index e25d50b6..c5e7677e 100644 --- a/src/com/projectkorra/ProjectKorra/firebending/WallOfFire.java +++ b/src/com/projectkorra/ProjectKorra/firebending/WallOfFire.java @@ -141,9 +141,9 @@ public class WallOfFire { Location location = origin.clone().add( orthoud.clone().multiply(j)); location = location.add(ortholr.clone().multiply(i)); -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.WallOfFire, location)) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "WallOfFire", location)) + continue; Block block = location.getBlock(); if (!blocks.contains(block)) blocks.add(block); @@ -168,9 +168,9 @@ public class WallOfFire { if (entities.contains(player)) entities.remove(player); for (Entity entity : entities) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.WallOfFire, -// entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "WallOfFire", + entity.getLocation())) + continue; for (Block block : blocks) { if (entity.getLocation().distance(block.getLocation()) <= 1.5) { affect(entity); @@ -189,161 +189,6 @@ public class WallOfFire { } } - // public WallOfFire(Player player) { - // if (ID >= Integer.MAX_VALUE) { - // ID = Integer.MIN_VALUE; - // } - // id = ID++; - // this.player = player; - // instances.put(id, this); - // World world = player.getWorld(); - // if (cooldowns.containsKey(player)) { - // if (cooldowns.get(player) + cooldown <= System.currentTimeMillis()) { - // if (Methods.isDay(player.getWorld())) { - // width = (int) Methods.firebendingDayAugment((double) width, - // world); - // height = (int) Methods.firebendingDayAugment((double) height, - // world); - // duration = (long) Methods.firebendingDayAugment( - // (double) duration, world); - // damage = (int) Methods.firebendingDayAugment((double) damage, - // world); - // } - // WallOfFireStart(player); - // } - // } else { - // - // if (Methods.isDay(player.getWorld())) { - // width = (int) Methods - // .firebendingDayAugment((double) width, world); - // height = (int) Methods.firebendingDayAugment((double) height, - // world); - // duration = (long) Methods.firebendingDayAugment( - // (double) duration, world); - // damage = (int) Methods.firebendingDayAugment((double) damage, - // world); - // } - // WallOfFireStart(player); - // } - // } - // - // public void WallOfFireStart(Player p) { - // durations.put(p, System.currentTimeMillis()); - // intervals.put(p, System.currentTimeMillis()); - // Block tblock = p.getTargetBlock(null, range).getRelative(BlockFace.UP); - // Location loc = tblock.getLocation(); - // locations.put(p, loc); - // playerlocations.put(p, p.getLocation()); - // cooldowns.put(p, System.currentTimeMillis()); - // if (tblock.getType() != Material.AIR - // && !FireStream.isIgnitable(player, tblock)) { - // instances.remove(id); - // durations.remove(p); - // cooldowns.remove(p); - // } - // if (cooldowns.containsKey(p) && AvatarState.isAvatarState(p)) - // cooldowns.remove(p); - // } - // - // public static void manageWallOfFire(int ID) { - // if (instances.containsKey(ID)) { - // WallOfFire wof = instances.get(ID); - // Player p = instances.get(ID).player; - // - // int damage = wof.damage; - // int width = wof.width; - // int height = wof.height; - // long duration = wof.duration; - // - // if (durations.containsKey(p)) { - // if (durations.get(p) + duration >= System.currentTimeMillis()) { - // - // if (intervals.containsKey(p)) { - // if (intervals.get(p) + interval <= System - // .currentTimeMillis()) { - // - // List blocks = new ArrayList(); - // Location loc = locations.get(p); - // Location yaw = playerlocations.get(p); - // intervals.put(p, System.currentTimeMillis()); - // Vector direction = yaw.getDirection().normalize(); - // double ox, oy, oz; - // ox = -direction.getZ(); - // oy = 0; - // oz = direction.getX(); - // Vector orth = new Vector(ox, oy, oz); - // orth = orth.normalize(); - // blocks.add(loc); - // for (int i = -width; i <= width; i++) { - // Block block = loc.getWorld().getBlockAt( - // loc.clone().add( - // orth.clone().multiply( - // (double) i))); - // if (FireStream.isIgnitable(p, block)) - // block.setType(Material.AIR); - // for (int y = block.getY(); y <= block.getY() - // + height; y++) { - // Location loca = new Location( - // block.getWorld(), block.getX(), - // (int) y, block.getZ()); - // if (Methods.isRegionProtectedFromBuild(p, - // Abilities.WallOfFire, loca)) - // continue; - // blocks.add(loca); - // block.getWorld().playEffect(loca, - // Effect.MOBSPAWNER_FLAMES, 1, 20); - // blockslocation.put(p, blocks); - // } - // } - // } - // } - // if (blockslocation.containsKey(p)) { - // for (Location loca : blockslocation.get(p)) { - // FireBlast.removeFireBlastsAroundPoint(loca, 2); - // for (Entity en : Methods.getEntitiesAroundPoint( - // locations.get(p), width + 2)) { - // if (en instanceof Projectile) { - // if (loca.distance(en.getLocation()) <= 3) { - // // Methods.damageEntity(p, en, damage); - // en.setVelocity(en.getVelocity() - // .normalize().setX(0).setZ(0) - // .multiply(0.1)); - // en.setFireTicks(40); - // } - // } - // } - // for (Entity en : Methods.getEntitiesAroundPoint(loca, - // 2)) { - // if (!damaged.containsKey(en)) - // damaged.put(en, System.currentTimeMillis() - // + damageinterval); - // if (damaged.get(en) + damageinterval <= System - // .currentTimeMillis()) { - // Methods.damageEntity(p, en, damage); - // en.setVelocity(new Vector((en.getLocation() - // .getX() - loca.getBlock() - // .getLocation().getX()) * 0.2, 0.1, - // (en.getLocation().getZ() - loca - // .getBlock().getLocation() - // .getZ()) * 0.2)); - // en.setFireTicks(81); - // new Enflamed(en, p); - // damaged.put(en, System.currentTimeMillis()); - // } - // } - // } - // } - // } - // } - // } - // } - - public static String getDescription() { - return "To use this ability, click at a location. A wall of fire " - + "will appear at this location, igniting enemies caught in it " - + "and blocking projectiles."; - } - public static void manage() { for (Player player : instances.keySet()) { instances.get(player).progress(); diff --git a/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java b/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java index d2d26537..d4d1850e 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/Bloodbending.java @@ -40,12 +40,12 @@ public class Bloodbending { player.getLocation(), range)) { if (entity instanceof LivingEntity) { if (entity instanceof Player) { -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.Bloodbending, entity.getLocation()) - if (AvatarState.isAvatarState((Player) entity) + if (Methods.isRegionProtectedFromBuild(player, + "Bloodbending", entity.getLocation()) + || (AvatarState.isAvatarState((Player) entity) || entity.getEntityId() == player.getEntityId() || Methods.canBend(((Player) entity).getName(), - "Bloodbending")) + "Bloodbending"))) continue; } Methods.damageEntity(player, entity, 0); @@ -56,9 +56,9 @@ public class Bloodbending { Entity target = Methods.getTargetedEntity(player, range, new ArrayList()); if (target == null) return; - if (!(target instanceof LivingEntity)) -// || Methods.isRegionProtectedFromBuild(player, -// Abilities.Bloodbending, target.getLocation())) + if (!(target instanceof LivingEntity) + || Methods.isRegionProtectedFromBuild(player, + "Bloodbending", target.getLocation())) return; if (target instanceof Player) { if (Methods.canBend(((Player) target).getName(), "Bloodbending") @@ -117,9 +117,9 @@ public class Bloodbending { ArrayList entities = new ArrayList(); for (Entity entity : Methods.getEntitiesAroundPoint( player.getLocation(), range)) { -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.Bloodbending, entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "Bloodbending", entity.getLocation())) + continue; if (entity instanceof Player) { if (!Methods.canBeBloodbent((Player) entity)) continue; diff --git a/src/com/projectkorra/ProjectKorra/waterbending/FreezeMelt.java b/src/com/projectkorra/ProjectKorra/waterbending/FreezeMelt.java index ac7a4636..216cc39c 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/FreezeMelt.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/FreezeMelt.java @@ -50,9 +50,9 @@ public class FreezeMelt { } private static boolean isFreezable(Player player, Block block) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.PhaseChange, -// block.getLocation())) -// return false; + if (Methods.isRegionProtectedFromBuild(player, "PhaseChange", + block.getLocation())) + return false; if (block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER) if (WaterManipulation.canPhysicsChange(block) @@ -62,9 +62,9 @@ public class FreezeMelt { } static void freeze(Player player, Block block) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.PhaseChange, -// block.getLocation())) -// return; + if (Methods.isRegionProtectedFromBuild(player, "PhaseChange", + block.getLocation())) + return; if (TempBlock.isTempBlock(block)) return; byte data = block.getData(); diff --git a/src/com/projectkorra/ProjectKorra/waterbending/HealingWaters.java b/src/com/projectkorra/ProjectKorra/waterbending/HealingWaters.java index d45dccaa..0f909539 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/HealingWaters.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/HealingWaters.java @@ -78,8 +78,8 @@ public class HealingWaters { } private static void applyHealing(Player player) { -// if (!Methods.isRegionProtectedFromBuild(player, Abilities.HealingWaters, -// player.getLocation())) + if (!Methods.isRegionProtectedFromBuild(player, "HealingWaters", + player.getLocation())) player.addPotionEffect(new PotionEffect( PotionEffectType.REGENERATION, 70, 1)); } diff --git a/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java b/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java index 844fe8f7..9635b95b 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/IceSpike.java @@ -214,9 +214,9 @@ public class IceSpike { progress++; Block affectedblock = location.clone().add(direction).getBlock(); location = location.add(direction); -// if (Methods.isRegionProtectedFromBuild(player, Abilities.IceSpike, -// location)) -// return false; + if (Methods.isRegionProtectedFromBuild(player, "IceSpike", + location)) + return false; for (Entity en : Methods.getEntitiesAroundPoint(location, 1.4)) { if (en instanceof LivingEntity && en != player && !damaged.contains(((LivingEntity) en))) { diff --git a/src/com/projectkorra/ProjectKorra/waterbending/IceSpike2.java b/src/com/projectkorra/ProjectKorra/waterbending/IceSpike2.java index 2775f96f..9a1ed371 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/IceSpike2.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/IceSpike2.java @@ -277,12 +277,12 @@ public class IceSpike2 { return; } -// if (Methods.isRegionProtectedFromBuild(player, Abilities.IceSpike, -// location)) { -// cancel(); -// returnWater(); -// return; -// } + if (Methods.isRegionProtectedFromBuild(player, "IceSpike", + location)) { + cancel(); + returnWater(); + return; + } for (Entity entity : Methods.getEntitiesAroundPoint(location, affectingradius)) { @@ -357,9 +357,9 @@ public class IceSpike2 { Location location = player.getEyeLocation(); Vector vector = location.getDirection(); Location mloc = ice.location; -// if (Methods.isRegionProtectedFromBuild(player, Abilities.IceSpike, -// mloc)) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "IceSpike", + mloc)) + continue; if (mloc.distance(location) <= defaultrange && Methods.getDistanceFromLine(vector, location, ice.location) < deflectrange && mloc.distance(location.clone().add(vector)) < mloc @@ -392,9 +392,9 @@ public class IceSpike2 { if (!ice.progressing) continue; -// if (Methods.isRegionProtectedFromBuild(player, Abilities.IceSpike, -// ice.location)) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "IceSpike", + ice.location)) + continue; Location location = player.getEyeLocation(); Vector vector = location.getDirection(); diff --git a/src/com/projectkorra/ProjectKorra/waterbending/Melt.java b/src/com/projectkorra/ProjectKorra/waterbending/Melt.java index 4ec3c586..f8a7a0ac 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/Melt.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/Melt.java @@ -56,9 +56,9 @@ public class Melt { } public static void melt(Player player, Block block) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.PhaseChange, -// block.getLocation())) -// return; + if (Methods.isRegionProtectedFromBuild(player, "PhaseChange", + block.getLocation())) + return; if (!Wave.canThaw(block)) { Wave.thaw(block); return; @@ -83,9 +83,9 @@ public class Melt { } public static void evaporate(Player player, Block block) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.PhaseChange, -// block.getLocation())) -// return; + if (Methods.isRegionProtectedFromBuild(player, "PhaseChange", + block.getLocation())) + return; if (Methods.isWater(block) && !TempBlock.isTempBlock(block) && WaterManipulation.canPhysicsChange(block)) { block.setType(Material.AIR); diff --git a/src/com/projectkorra/ProjectKorra/waterbending/OctopusForm.java b/src/com/projectkorra/ProjectKorra/waterbending/OctopusForm.java index bf6fcfad..42058fbd 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/OctopusForm.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/OctopusForm.java @@ -129,9 +129,9 @@ public class OctopusForm { for (Entity entity : Methods.getEntitiesAroundPoint(location, 2.5)) { if (entity.getEntityId() == player.getEntityId()) continue; -// if (Methods.isRegionProtectedFromBuild(player, Abilities.OctopusForm, -// entity.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "OctopusForm", + entity.getLocation())) + continue; // if (Torrent.canThaw(entity.getLocation().getBlock()) // || Wave.canThaw(entity.getLocation().getBlock())) // continue; @@ -362,9 +362,9 @@ public class OctopusForm { private void addWater(Block block) { clearNearbyWater(block); -// if (Methods.isRegionProtectedFromBuild(player, Abilities.OctopusForm, -// block.getLocation())) -// return; + if (Methods.isRegionProtectedFromBuild(player, "OctopusForm", + block.getLocation())) + return; if (TempBlock.isTempBlock(block)) { TempBlock tblock = TempBlock.get(block); if (!newblocks.contains(tblock)) { diff --git a/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java b/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java index 508e40dc..9aff0feb 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/Torrent.java @@ -275,7 +275,7 @@ public class Torrent { if (Math.abs(theta - startangle) < 10) location = blockloc.clone(); Block block = blockloc.getBlock(); - if (!doneblocks.contains(block)) { + if (!doneblocks.contains(block) && !Methods.isRegionProtectedFromBuild(player, "Torrent", blockloc)) { if (Methods.isTransparentToEarthbending(player, block) && !block.isLiquid()) { launchblocks.add(new TempBlock(block, Material.WATER, @@ -324,7 +324,7 @@ public class Torrent { // player.sendBlockChange(location, 20, (byte) 0); - if (location.distance(player.getLocation()) > range) { + if (location.distance(player.getLocation()) > range || Methods.isRegionProtectedFromBuild(player, "Torrent", location)) { if (layer < maxlayer) if (freeze || layer < 1) layer++; diff --git a/src/com/projectkorra/ProjectKorra/waterbending/WaterManipulation.java b/src/com/projectkorra/ProjectKorra/waterbending/WaterManipulation.java index e66d3d75..271eadd8 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/WaterManipulation.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/WaterManipulation.java @@ -148,8 +148,8 @@ public class WaterManipulation { } -// BendingPlayer.getBendingPlayer(player).cooldown( -// Abilities.WaterManipulation); + // BendingPlayer.getBendingPlayer(player).cooldown( + // Abilities.WaterManipulation); } } @@ -206,11 +206,11 @@ public class WaterManipulation { } if (System.currentTimeMillis() - time >= interval) { // removeWater(oldwater); - // if (Methods.isRegionProtectedFromBuild(player, - // Abilities.WaterManipulation, location)) { - // breakBlock(); - // return false; - // } + if (Methods.isRegionProtectedFromBuild(player, + "WaterManipulation", location)) { + breakBlock(); + return false; + } time = System.currentTimeMillis(); @@ -544,9 +544,9 @@ public class WaterManipulation { if (!manip.location.getWorld().equals(player.getWorld())) continue; -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.WaterManipulation, manip.location)) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "WaterManipulation", manip.location)) + continue; if (manip.player.equals(player)) manip.redirect(player, getTargetLocation(player)); @@ -578,10 +578,10 @@ public class WaterManipulation { if (!manip.progressing) continue; -// -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.WaterManipulation, manip.location)) -// continue; + + if (Methods.isRegionProtectedFromBuild(player, + "WaterManipulation", manip.location)) + continue; Location location = player.getEyeLocation(); Vector vector = location.getDirection(); diff --git a/src/com/projectkorra/ProjectKorra/waterbending/WaterReturn.java b/src/com/projectkorra/ProjectKorra/waterbending/WaterReturn.java index d092e8cf..67475db7 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/WaterReturn.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/WaterReturn.java @@ -35,12 +35,13 @@ public class WaterReturn { this.player = player; location = block.getLocation(); if (Methods.canBend(player.getName(), "WaterManipulation")) { -// if (!Methods.isRegionProtectedFromBuild(player, -// Abilities.WaterManipulation, location) -// && Methods.canBend(player, Abilities.WaterManipulation)) { - if (Methods.isTransparentToEarthbending(player, block) - && !block.isLiquid()) - this.block = new TempBlock(block, Material.WATER, full); + if (!Methods.isRegionProtectedFromBuild(player, + "WaterManipulation", location) + && Methods.canBend(player.getName(), "WaterManipulation")) { + if (Methods.isTransparentToEarthbending(player, block) + && !block.isLiquid()) + this.block = new TempBlock(block, Material.WATER, full); + } } // if (ID >= Integer.MAX_VALUE) { // ID = Integer.MIN_VALUE; @@ -82,11 +83,11 @@ public class WaterReturn { if (location.getBlock().equals(block.getLocation().getBlock())) return; -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.WaterManipulation, location)) { -// remove(); -// return; -// } + if (Methods.isRegionProtectedFromBuild(player, + "WaterManipulation", location)) { + remove(); + return; + } if (location.distance(player.getEyeLocation()) > Methods .waterbendingNightAugment(range, player.getWorld())) { diff --git a/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java b/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java index 5ed43cf0..31b9ca32 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/WaterSpout.java @@ -151,9 +151,9 @@ public class WaterSpout { Block blocki; for (int i = 0; i < maxheight; i++) { blocki = location.clone().add(0, -i, 0).getBlock(); -// if (Methods.isRegionProtectedFromBuild(player, Abilities.WaterSpout, -// blocki.getLocation())) -// return -1; + if (Methods.isRegionProtectedFromBuild(player, "WaterSpout", + blocki.getLocation())) + return -1; if (!affectedblocks.contains(blocki)) { if (blocki.getType() == Material.WATER || blocki.getType() == Material.STATIONARY_WATER) { diff --git a/src/com/projectkorra/ProjectKorra/waterbending/WaterWall.java b/src/com/projectkorra/ProjectKorra/waterbending/WaterWall.java index af411216..ab8d2864 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/WaterWall.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/WaterWall.java @@ -291,9 +291,9 @@ public class WaterWall { // loc.getBlock().setType(Material.GLOWSTONE); vec = Methods.getOrthogonalVector(dir.clone(), angle, i); block = loc.clone().add(vec).getBlock(); -// if (Methods.isRegionProtectedFromBuild(player, -// Abilities.Surge, block.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, + "Surge", block.getLocation())) + continue; if (wallblocks.containsKey(block)) { blocks.add(block); } else if (!blocks.contains(block) @@ -440,23 +440,15 @@ public class WaterWall { private void addWater(Block block) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.Surge, -// block.getLocation())) -// return; + if (Methods.isRegionProtectedFromBuild(player, "Surge", + block.getLocation())) + return; if (!TempBlock.isTempBlock(block)) { new TempBlock(block, Material.WATER, full); // new TempBlock(block, Material.ICE, (byte) 0); affectedblocks.put(block, block); } - - // if (!affectedblocks.containsKey(block)) { - // affectedblocks.put(block, block); - // } - // if (FreezeMelt.frozenblocks.containsKey(block)) - // FreezeMelt.frozenblocks.remove(block); - // block.setType(Material.WATER); - // block.setData(full); } public static void moveWater(Player player) { diff --git a/src/com/projectkorra/ProjectKorra/waterbending/Wave.java b/src/com/projectkorra/ProjectKorra/waterbending/Wave.java index 517bd237..62528f88 100644 --- a/src/com/projectkorra/ProjectKorra/waterbending/Wave.java +++ b/src/com/projectkorra/ProjectKorra/waterbending/Wave.java @@ -248,7 +248,7 @@ public class Wave { ArrayList blocks = new ArrayList(); - if ((((blockl.getType() == Material.AIR + if (!Methods.isRegionProtectedFromBuild(player, "Surge", location) && (((blockl.getType() == Material.AIR || blockl.getType() == Material.FIRE || Methods.isPlant(blockl) || Methods.isWater(blockl) || Methods @@ -376,9 +376,9 @@ public class Wave { } private void addWater(Block block) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.Surge, -// block.getLocation())) -// return; + if (Methods.isRegionProtectedFromBuild(player, "Surge", + block.getLocation())) + return; if (!TempBlock.isTempBlock(block)) { new TempBlock(block, Material.WATER, full); // new TempBlock(block, Material.ICE, (byte) 0); @@ -441,11 +441,11 @@ public class Wave { for (Block block : Methods.getBlocksAroundPoint(frozenlocation, freezeradius)) { -// if (Methods.isRegionProtectedFromBuild(player, Abilities.Surge, -// block.getLocation()) -// || Methods.isRegionProtectedFromBuild(player, -// Abilities.PhaseChange, block.getLocation())) -// continue; + if (Methods.isRegionProtectedFromBuild(player, "Surge", + block.getLocation()) + || Methods.isRegionProtectedFromBuild(player, + "PhaseChange", block.getLocation())) + continue; if (TempBlock.isTempBlock(block)) continue; if (block.getType() == Material.AIR