diff --git a/src/com/projectkorra/projectkorra/BendingPlayer.java b/src/com/projectkorra/projectkorra/BendingPlayer.java index ce1aed51..41d8123d 100644 --- a/src/com/projectkorra/projectkorra/BendingPlayer.java +++ b/src/com/projectkorra/projectkorra/BendingPlayer.java @@ -266,12 +266,12 @@ public class BendingPlayer { return false; } - if (!ignoreCooldowns && this.cooldowns.containsKey(this.name)) { - if (this.cooldowns.get(this.name).getCooldown() + getConfig().getLong("Properties.GlobalCooldown") >= System.currentTimeMillis()) { + if (!ignoreCooldowns && this.cooldowns.containsKey(ability.getName())) { + if (this.cooldowns.get(ability.getName()).getCooldown() + getConfig().getLong("Properties.GlobalCooldown") >= System.currentTimeMillis()) { return false; } - this.cooldowns.remove(this.name); + this.cooldowns.remove(ability.getName()); } if (this.isChiBlocked() || this.isParalyzed() || (this.isBloodbent() && !ability.getName().equalsIgnoreCase("AvatarState")) || this.isControlledByMetalClips()) { diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index d2e4326e..1e3c6f33 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -179,6 +179,7 @@ import com.projectkorra.projectkorra.waterbending.Torrent; import com.projectkorra.projectkorra.waterbending.WaterBubble; import com.projectkorra.projectkorra.waterbending.WaterManipulation; import com.projectkorra.projectkorra.waterbending.WaterSpout; +import com.projectkorra.projectkorra.waterbending.WaterSpoutWave; import com.projectkorra.projectkorra.waterbending.blood.Bloodbending; import com.projectkorra.projectkorra.waterbending.combo.IceBullet; import com.projectkorra.projectkorra.waterbending.healing.HealingWaters; @@ -236,6 +237,8 @@ public class PKListener implements Listener { ability = CoreAbility.getAbility(SurgeWall.class); } else if (abil != null && abil.equalsIgnoreCase("Torrent")) { ability = CoreAbility.getAbility(Torrent.class); + } else if (abil != null && abil.equalsIgnoreCase("WaterSpout")) { + ability = CoreAbility.getAbility(WaterSpoutWave.class); } else { ability = CoreAbility.getAbility(abil); } diff --git a/src/com/projectkorra/projectkorra/ability/CoreAbility.java b/src/com/projectkorra/projectkorra/ability/CoreAbility.java index cdfb4c9e..b37d1b36 100644 --- a/src/com/projectkorra/projectkorra/ability/CoreAbility.java +++ b/src/com/projectkorra/projectkorra/ability/CoreAbility.java @@ -786,9 +786,7 @@ public abstract class CoreAbility implements Ability { } String tag = null; - if (this instanceof ComboAbility) { - tag = "Abilities." + elementName + "." + elementName + "Combo." + this.getName() + ".Enabled"; - } else if (this instanceof PassiveAbility) { + if (this instanceof PassiveAbility) { tag = "Abilities." + elementName + ".Passive." + this.getName() + ".Enabled"; } else { tag = "Abilities." + elementName + "." + this.getName() + ".Enabled"; diff --git a/src/com/projectkorra/projectkorra/airbending/AirSuction.java b/src/com/projectkorra/projectkorra/airbending/AirSuction.java index 3aff0212..e8669793 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSuction.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSuction.java @@ -245,6 +245,19 @@ public class AirSuction extends AirAbility { this.advanceLocation(); } else { + if (bPlayer == null || player.isDead() || !player.isOnline()) { + return; + } else if (!origin.getWorld().equals(player.getWorld())) { + remove(); + return; + } else if (!bPlayer.canBendIgnoreCooldowns(this)) { + remove(); + return; + } else if (origin.distanceSquared(player.getEyeLocation()) > getSelectRange() * getSelectRange()) { + remove(); + return; + } + playAirbendingParticles(this.origin, 5, 0.5, 0.5, 0.5); } } diff --git a/src/com/projectkorra/projectkorra/airbending/AirSwipe.java b/src/com/projectkorra/projectkorra/airbending/AirSwipe.java index 1fb81ce8..7225ff61 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirSwipe.java +++ b/src/com/projectkorra/projectkorra/airbending/AirSwipe.java @@ -57,7 +57,7 @@ public class AirSwipe extends AirAbility { private double maxChargeFactor; private Location origin; private Random random; - private Map elements; + private Map streams; private ArrayList affectedEntities; public AirSwipe(final Player player) { @@ -91,7 +91,7 @@ public class AirSwipe extends AirAbility { this.radius = getConfig().getDouble("Abilities.Air.AirSwipe.Radius"); this.maxChargeFactor = getConfig().getDouble("Abilities.Air.AirSwipe.ChargeFactor"); this.random = new Random(); - this.elements = new ConcurrentHashMap<>(); + this.streams = new ConcurrentHashMap<>(); this.affectedEntities = new ArrayList<>(); if (this.bPlayer.isOnCooldown(this) || player.getEyeLocation().getBlock().isLiquid()) { @@ -127,8 +127,8 @@ public class AirSwipe extends AirAbility { public static boolean removeSwipesAroundPoint(final Location loc, final double radius) { boolean removed = false; for (final AirSwipe aswipe : getAbilities(AirSwipe.class)) { - for (final Vector vec : aswipe.elements.keySet()) { - final Location vectorLoc = aswipe.elements.get(vec); + for (final Vector vec : aswipe.streams.keySet()) { + final Location vectorLoc = aswipe.streams.get(vec); if (vectorLoc != null && vectorLoc.getWorld().equals(loc.getWorld())) { if (vectorLoc.distanceSquared(loc) <= radius * radius) { aswipe.remove(); @@ -142,19 +142,19 @@ public class AirSwipe extends AirAbility { private void advanceSwipe() { this.affectedEntities.clear(); - for (final Vector direction : this.elements.keySet()) { - Location location = this.elements.get(direction); + for (final Vector direction : this.streams.keySet()) { + Location location = this.streams.get(direction); if (direction != null && location != null) { location = location.clone().add(direction.clone().multiply(this.speed)); - this.elements.put(direction, location); + this.streams.put(direction, location); if (location.distanceSquared(this.origin) > this.range * this.range || GeneralMethods.isRegionProtectedFromBuild(this, location)) { - this.elements.clear(); + this.streams.clear(); } else { final Block block = location.getBlock(); if (!ElementalAbility.isTransparent(this.player, block)) { - this.remove(); - return; + this.streams.remove(direction); + continue; } for (final Block testblock : GeneralMethods.getBlocksAroundPoint(location, this.radius)) { @@ -169,7 +169,7 @@ public class AirSwipe extends AirAbility { } else if (isPlant(block.getType())) { block.breakNaturally(); } else { - this.elements.remove(direction); + this.streams.remove(direction); } if (isLava(block)) { if (LavaFlow.isLavaFlowBlock(block)) { @@ -190,7 +190,7 @@ public class AirSwipe extends AirAbility { } } } - if (this.elements.isEmpty()) { + if (this.streams.isEmpty()) { this.remove(); } } @@ -199,6 +199,14 @@ public class AirSwipe extends AirAbility { final List entities = GeneralMethods.getEntitiesAroundPoint(location, this.radius); final Vector fDirection = direction.clone(); + for (int i = 0; i < entities.size(); i++) { + Location entityLocation = entities.get(i).getLocation(); + Vector dir = new Vector(entityLocation.getX() - location.getX(), entityLocation.getY() - location.getY(), entityLocation.getZ() - location.getZ()); + if (GeneralMethods.checkDiagonalWall(location, dir)) { + entities.remove(entities.get(i--)); + } + } + for (int i = 0; i < entities.size(); i++) { final Entity entity = entities.get(i); final AirSwipe abil = this; @@ -226,7 +234,7 @@ public class AirSwipe extends AirAbility { AirSwipe.this.affectedEntities.add(entity); } breakBreathbendingHold(entity); - AirSwipe.this.elements.remove(direction); + AirSwipe.this.streams.remove(direction); } else if (entity.getEntityId() != AirSwipe.this.player.getEntityId() && !(entity instanceof LivingEntity)) { GeneralMethods.setVelocity(entity, fDirection.multiply(AirSwipe.this.pushFactor)); @@ -254,7 +262,7 @@ public class AirSwipe extends AirAbility { direction.setX(vx); direction.setZ(vz); - this.elements.put(direction, this.origin); + this.streams.put(direction, this.origin); } } @@ -271,7 +279,7 @@ public class AirSwipe extends AirAbility { } if (!this.charging) { - if (this.elements.isEmpty()) { + if (this.streams.isEmpty()) { this.remove(); return; } @@ -303,7 +311,7 @@ public class AirSwipe extends AirAbility { @Override public Location getLocation() { - return this.elements.size() != 0 ? this.elements.values().iterator().next() : null; + return this.streams.size() != 0 ? this.streams.values().iterator().next() : null; } @Override @@ -334,7 +342,7 @@ public class AirSwipe extends AirAbility { @Override public List getLocations() { final ArrayList locations = new ArrayList<>(); - for (final Location swipeLoc : this.elements.values()) { + for (final Location swipeLoc : this.streams.values()) { locations.add(swipeLoc); } return locations; @@ -433,7 +441,7 @@ public class AirSwipe extends AirAbility { } public Map getElements() { - return this.elements; + return this.streams; } public ArrayList getAffectedEntities() { diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 757349fa..6f05790c 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -686,7 +686,7 @@ public class ConfigManager { config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Damage", 4.5); config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Push", 1.0); config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Range", 24); - config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Radius", 3); + config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Radius", 0.75); config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.ChargeTime", 1000); config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.Damage", 3); config.addDefault("Abilities.Avatar.AvatarState.Air.AirShield.IsAvatarStateToggle", true); @@ -876,7 +876,7 @@ public class ConfigManager { config.addDefault("Abilities.Air.AirSwipe.Enabled", true); config.addDefault("Abilities.Air.AirSwipe.Damage", 2); config.addDefault("Abilities.Air.AirSwipe.Range", 14); - config.addDefault("Abilities.Air.AirSwipe.Radius", 2); + config.addDefault("Abilities.Air.AirSwipe.Radius", 0.5); config.addDefault("Abilities.Air.AirSwipe.Push", 0.5); config.addDefault("Abilities.Air.AirSwipe.Arc", 16); config.addDefault("Abilities.Air.AirSwipe.Speed", 25); @@ -1035,11 +1035,15 @@ public class ConfigManager { config.addDefault("Abilities.Water.Surge.Wave.MaxFreezeRadius", 7); config.addDefault("Abilities.Water.Surge.Wave.Cooldown", 500); config.addDefault("Abilities.Water.Surge.Wave.Interval", 30); + config.addDefault("Abilities.Water.Surge.Wave.SolidifyLava.Enabled", true); + config.addDefault("Abilities.Water.Surge.Wave.SolidifyLava.Duration", 36000); config.addDefault("Abilities.Water.Surge.Wall.Range", 5); config.addDefault("Abilities.Water.Surge.Wall.Radius", 2); config.addDefault("Abilities.Water.Surge.Wall.Cooldown", 0); config.addDefault("Abilities.Water.Surge.Wall.Duration", 0); config.addDefault("Abilities.Water.Surge.Wall.Interval", 30); + config.addDefault("Abilities.Water.Surge.Wall.SolidifyLava.Enabled", true); + config.addDefault("Abilities.Water.Surge.Wall.SolidifyLava.Duration", 36000); config.addDefault("Abilities.Water.Surge.Wave.IceRevertTime", 60000); config.addDefault("Abilities.Water.Torrent.Enabled", true); diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java index fded2585..9eb7b490 100644 --- a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java +++ b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java @@ -39,6 +39,10 @@ public class DensityShift extends EarthAbility implements PassiveAbility { } if (ElementalAbility.isEarth(block)) { + if ((player.getLocation().getY() % 1) != 0) { + return true; + } + for (final Block affectedBlock : GeneralMethods.getBlocksAroundPoint(block.getLocation(), 2)) { if (ElementalAbility.isEarth(affectedBlock)) { if (GeneralMethods.isSolid(affectedBlock.getRelative(BlockFace.DOWN))) { diff --git a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java index 1d1cc480..6ddbac66 100644 --- a/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java +++ b/src/com/projectkorra/projectkorra/waterbending/OctopusForm.java @@ -236,6 +236,9 @@ public class OctopusForm extends WaterAbility { this.bPlayer.addCooldown(this); this.remove(); return; + } else if (!isWaterbendable(this.sourceBlock) && !this.settingUp && !this.forming && !this.formed) { + this.remove(); + return; } final Random random = new Random(); diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java index 52868949..5f3d32bd 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWall.java @@ -10,7 +10,10 @@ import java.util.concurrent.ConcurrentHashMap; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Levelled; import org.bukkit.entity.Player; import org.bukkit.util.Vector; @@ -39,12 +42,14 @@ public class SurgeWall extends WaterAbility { private boolean settingUp; private boolean forming; private boolean frozen; + private boolean solidifyLava; private long time; private long interval; @Attribute(Attribute.COOLDOWN) private long cooldown; @Attribute(Attribute.DURATION) private long duration; + private long obsidianDuration; @Attribute(Attribute.RADIUS) private double radius; @Attribute(Attribute.RANGE) @@ -66,6 +71,8 @@ public class SurgeWall extends WaterAbility { this.duration = getConfig().getLong("Abilities.Water.Surge.Wall.Duration"); this.range = getConfig().getDouble(RANGE_CONFIG); this.radius = getConfig().getDouble("Abilities.Water.Surge.Wall.Radius"); + this.solidifyLava = getConfig().getBoolean("Abilities.Water.Surge.Wall.SolidifyLava.Enabled"); + this.obsidianDuration = getConfig().getLong("Abilities.Water.Surge.Wall.SolidifyLava.Duration"); this.locations = new ArrayList<>(); this.oldTemps = new HashMap<>(); @@ -102,7 +109,7 @@ public class SurgeWall extends WaterAbility { final Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock(); if (isTransparent(player, block) && isTransparent(player, eyeLoc.getBlock())) { - final TempBlock tempBlock = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + final TempBlock tempBlock = new TempBlock(block, Material.WATER); SOURCE_BLOCKS.add(tempBlock); wave = new SurgeWave(player); @@ -145,7 +152,7 @@ public class SurgeWall extends WaterAbility { this.frozen = false; for (final Block block : WALL_BLOCKS.keySet()) { if (WALL_BLOCKS.get(block) == this.player) { - new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + new TempBlock(block, Material.WATER); } } } @@ -232,7 +239,11 @@ public class SurgeWall extends WaterAbility { this.bPlayer.addCooldown(this); this.remove(); return; + } else if (!isWaterbendable(this.sourceBlock) && !this.settingUp && !this.forming && !this.progressing) { + remove(); + return; } + this.locations.clear(); if (System.currentTimeMillis() - this.time >= this.interval) { @@ -284,7 +295,26 @@ public class SurgeWall extends WaterAbility { if (WALL_BLOCKS.get(blocki) == this.player && !blocks.contains(blocki)) { this.finalRemoveWater(blocki); } + + if (solidifyLava) { + for (BlockFace relative : BlockFace.values()) { + Block blockRelative = blocki.getRelative(relative); + if (blockRelative.getType() == Material.LAVA) { + Levelled levelled = (Levelled)blockRelative.getBlockData(); + TempBlock tempBlock; + + if (levelled.getLevel() == 0) + tempBlock = new TempBlock(blockRelative, Material.OBSIDIAN); + else + tempBlock = new TempBlock(blockRelative, Material.COBBLESTONE); + + tempBlock.setRevertTime(obsidianDuration); + tempBlock.getBlock().getWorld().playSound(tempBlock.getLocation(), Sound.BLOCK_LAVA_EXTINGUISH, 0.2F, 1); + } + } + } } + return; } @@ -334,7 +364,7 @@ public class SurgeWall extends WaterAbility { if (this.frozen) { new TempBlock(block, Material.ICE); } else { - new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + new TempBlock(block, Material.WATER); } } @@ -401,7 +431,7 @@ public class SurgeWall extends WaterAbility { if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { return; } else if (!TempBlock.isTempBlock(block)) { - new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + new TempBlock(block, Material.WATER); AFFECTED_BLOCKS.put(block, block); } } @@ -443,7 +473,7 @@ public class SurgeWall extends WaterAbility { final Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock(); if (isTransparent(player, block) && isTransparent(player, eyeLoc.getBlock())) { - final TempBlock tempBlock = new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + final TempBlock tempBlock = new TempBlock(block, Material.WATER); SOURCE_BLOCKS.add(tempBlock); wall = new SurgeWall(player); diff --git a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java index 4a1807a9..08f181a0 100644 --- a/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/SurgeWave.java @@ -9,7 +9,10 @@ import java.util.concurrent.ConcurrentHashMap; import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.block.data.Levelled; import org.bukkit.entity.Entity; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; @@ -17,8 +20,6 @@ import org.bukkit.util.Vector; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.AirAbility; -import com.projectkorra.projectkorra.ability.ElementalAbility; -import com.projectkorra.projectkorra.ability.FireAbility; import com.projectkorra.projectkorra.ability.WaterAbility; import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.avatar.AvatarState; @@ -37,12 +38,14 @@ public class SurgeWave extends WaterAbility { private boolean activateFreeze; private boolean progressing; private boolean canHitSelf; + private boolean solidifyLava; private long time; @Attribute(Attribute.COOLDOWN) private long cooldown; private long interval; @Attribute("IceRevertTime") private long iceRevertTime; + private long obsidianDuration; private double currentRadius; @Attribute(Attribute.RADIUS) private double maxRadius; @@ -86,6 +89,8 @@ public class SurgeWave extends WaterAbility { this.iceRevertTime = getConfig().getLong("Abilities.Water.Surge.Wave.IceRevertTime"); this.range = getConfig().getDouble("Abilities.Water.Surge.Wave.Range"); this.selectRange = getConfig().getDouble("Abilities.Water.Surge.Wave.SelectRange"); + this.solidifyLava = getConfig().getBoolean("Abilities.Water.Surge.Wave.SolidifyLava.Enabled"); + this.obsidianDuration = getConfig().getLong("Abilities.Water.Surge.Wave.SolidifyLava.Duration"); this.waveBlocks = new ConcurrentHashMap<>(); this.frozenBlocks = new ConcurrentHashMap<>(); @@ -108,7 +113,7 @@ public class SurgeWave extends WaterAbility { if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { return; } else if (!TempBlock.isTempBlock(block)) { - new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + new TempBlock(block, Material.WATER); this.waveBlocks.put(block, block); } } @@ -270,6 +275,9 @@ public class SurgeWave extends WaterAbility { if (!this.bPlayer.canBendIgnoreBindsCooldowns(this)) { this.remove(); return; + } else if (!isWaterbendable(this.sourceBlock) && !this.progressing) { + this.remove(); + return; } if (System.currentTimeMillis() - this.time >= this.interval) { @@ -316,6 +324,24 @@ public class SurgeWave extends WaterAbility { if (!blocks.contains(block)) { this.finalRemoveWater(block); } + + if (solidifyLava) { + for (BlockFace relative : BlockFace.values()) { + Block blockRelative = block.getRelative(relative); + if (blockRelative.getType() == Material.LAVA) { + Levelled levelled = (Levelled)blockRelative.getBlockData(); + TempBlock tempBlock; + + if (levelled.getLevel() == 0) + tempBlock = new TempBlock(blockRelative, Material.OBSIDIAN); + else + tempBlock = new TempBlock(blockRelative, Material.COBBLESTONE); + + tempBlock.setRevertTime(obsidianDuration); + tempBlock.getBlock().getWorld().playSound(tempBlock.getLocation(), Sound.BLOCK_LAVA_EXTINGUISH, 0.2F, 1); + } + } + } } for (final Block block : blocks) { if (!this.waveBlocks.containsKey(block)) { diff --git a/src/com/projectkorra/projectkorra/waterbending/Torrent.java b/src/com/projectkorra/projectkorra/waterbending/Torrent.java index 582621bd..b6aa7a58 100644 --- a/src/com/projectkorra/projectkorra/waterbending/Torrent.java +++ b/src/com/projectkorra/projectkorra/waterbending/Torrent.java @@ -171,6 +171,9 @@ public class Torrent extends WaterAbility { if (!this.bPlayer.canBendIgnoreCooldowns(this)) { this.remove(); return; + } else if (!isWaterbendable(this.sourceBlock) && !this.settingUp && !this.forming && !this.formed && !this.launching) { + this.remove(); + return; } if (System.currentTimeMillis() > this.time + this.interval) { @@ -207,7 +210,7 @@ public class Torrent extends WaterAbility { this.sourceBlock.setType(Material.AIR); } - this.source = new TempBlock(this.sourceBlock, Material.WATER, GeneralMethods.getWaterData(0)); + this.source = new TempBlock(this.sourceBlock, Material.WATER); this.location = this.sourceBlock.getLocation(); } else { playFocusWaterEffect(this.sourceBlock); @@ -261,7 +264,7 @@ public class Torrent extends WaterAbility { this.remove(); return; } - this.source = new TempBlock(this.location.getBlock(), Material.WATER, GeneralMethods.getWaterData(0)); + this.source = new TempBlock(this.location.getBlock(), Material.WATER); } } if (this.forming && !this.player.isSneaking()) { @@ -354,7 +357,7 @@ public class Torrent extends WaterAbility { final Block block = blockloc.getBlock(); if (!doneBlocks.contains(block) && !GeneralMethods.isRegionProtectedFromBuild(this, blockloc)) { if (isTransparent(this.player, block)) { - this.launchedBlocks.add(new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0))); + this.launchedBlocks.add(new TempBlock(block, Material.WATER)); doneBlocks.add(block); } else if (!isTransparent(this.player, block)) { break; @@ -422,7 +425,7 @@ public class Torrent extends WaterAbility { if (isWater(locBlock)) { ParticleEffect.WATER_BUBBLE.display(locBlock.getLocation().clone().add(.5, .5, .5), 5, Math.random(), Math.random(), Math.random(), 0); } - newBlocks.add(new TempBlock(locBlock, Material.WATER, GeneralMethods.getWaterData(0))); + newBlocks.add(new TempBlock(locBlock, Material.WATER)); } else { if (this.layer < this.maxLayer) { if (this.layer == 0) { @@ -487,7 +490,7 @@ public class Torrent extends WaterAbility { final Block block = blockLoc.getBlock(); if (!doneBlocks.contains(block)) { if (isTransparent(this.player, block)) { - this.blocks.add(new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0))); + this.blocks.add(new TempBlock(block, Material.WATER)); doneBlocks.add(block); for (final Entity entity : entities) { if (entity.getWorld() != blockLoc.getWorld()) { diff --git a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java index 1184b6c4..636446cf 100644 --- a/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java +++ b/src/com/projectkorra/projectkorra/waterbending/WaterSpoutWave.java @@ -74,6 +74,7 @@ public class WaterSpoutWave extends WaterAbility { private double animationSpeed; private AbilityType type; private AnimateState animation; + private Block sourceBlock; private Vector direction; private Location origin; private Location location; @@ -163,30 +164,30 @@ public class WaterSpoutWave extends WaterAbility { if (this.type == AbilityType.CLICK) { if (this.origin == null) { this.removeOldType(this.player, AbilityType.CLICK); - final Block block = getWaterSourceBlock(this.player, this.selectRange, this.plant); + this.sourceBlock = getWaterSourceBlock(this.player, this.selectRange, this.plant); - if (block == null) { + if (this.sourceBlock == null) { this.remove(); return; } - final Block blockAbove = block.getRelative(BlockFace.UP); + final Block blockAbove = this.sourceBlock.getRelative(BlockFace.UP); if (!ElementalAbility.isAir(blockAbove.getType()) && !this.isWaterbendable(blockAbove)) { this.remove(); return; } - this.origin = block.getLocation(); - if (!this.isWaterbendable(block) || GeneralMethods.isRegionProtectedFromBuild(this, this.origin)) { + this.origin = this.sourceBlock.getLocation(); + if (!this.isWaterbendable(this.sourceBlock) || GeneralMethods.isRegionProtectedFromBuild(this, this.origin)) { this.remove(); return; - } else if (this.iceOnly && !(this.isIcebendable(block) || isSnow(block))) { + } else if (this.iceOnly && !(this.isIcebendable(this.sourceBlock) || isSnow(this.sourceBlock))) { this.remove(); return; } } - if (this.player.getLocation().distanceSquared(this.origin) > this.selectRange * this.selectRange) { + if (this.player.getLocation().distanceSquared(this.origin) > this.selectRange * this.selectRange || !isWaterbendable(this.sourceBlock)) { this.remove(); return; } else if (this.player.isSneaking()) { @@ -306,7 +307,7 @@ public class WaterSpoutWave extends WaterAbility { if (this.iceWave) { this.createBlockDelay(block, Material.ICE, Material.ICE.createBlockData(), 2L); } else { - this.createBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + this.createBlock(block, Material.WATER); } } } @@ -351,7 +352,7 @@ public class WaterSpoutWave extends WaterAbility { final Block block = this.player.getEyeLocation().add(dir).getBlock(); this.location = block.getLocation(); if (ElementalAbility.isAir(block.getType()) && !GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { - this.createBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); + this.createBlock(block, Material.WATER); } } } diff --git a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java index 29eea0e4..bd830bc2 100644 --- a/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java +++ b/src/com/projectkorra/projectkorra/waterbending/ice/IceSpikeBlast.java @@ -157,6 +157,9 @@ public class IceSpikeBlast extends IceAbility { } else if (!this.bPlayer.getBoundAbilityName().equals(this.getName()) && this.prepared) { this.remove(); return; + } else if (!isWaterbendable(this.sourceBlock) && !this.progressing && !this.settingUp) { + this.remove(); + return; } if (System.currentTimeMillis() < this.time + this.interval) { diff --git a/src/plugin.yml b/src/plugin.yml index a7f19c11..6d1df07b 100644 --- a/src/plugin.yml +++ b/src/plugin.yml @@ -1,6 +1,6 @@ name: ProjectKorra author: ProjectKorra -api-version: 1.13 +api-version: 1.16 version: ${project.version} main: com.projectkorra.projectkorra.ProjectKorra softdepend: [PreciousStones, WorldGuard, WorldEdit, FactionsFramework, GriefPrevention, Towny, NoCheatPlus, LWC, Residence, Kingdoms, RedProtect, PlaceholderAPI]