Include outstanding PR's and fix outstanding issues (#1069)

This PR moves over some outstanding PR's to the proper branch and resolves some extra issues. Thanks @xNuminousx!

## Additions
* Adds Surge interactions with Lava
    * Surge Wave and Surge Wall will both cause Lava to turn into TempBlock Cobblestone / Obsidian
    * Enabled via the new `Abilities.Water.Surge.Wave.SolidifyLava.Enabled` and `Abilities.Water.Surge.Wall.SolidifyLava.Enabled` config options. They both default to `true`
    * Duration of the created TempBlocks is set via the new `Abilities.Water.Surge.Wave.SolidifyLava.Duration` and `Abilities.Water.Surge.Wall.SolidifyLava.Duration` config options. They both default to `36000`

## Fixes
* Fixes DensityShift turning non-full blocks into Sand causing the player to get stuck in the ground. Now it will still prevent fall damage on non-full earthbendable blocks but will not turn them to Sand.
* Fixes EarthDome and potentially other combos from not respecting their `Enabled` config option
* Fixes players with usernames the same as ability names getting incorrect cooldowns applied. Resolves #1068 

## Misc. Changes
* Changes Water abilities that require sources to deactivate if their source is destroyed after selection occurs but before the ability starts
* Changes AirSuction origin selection to remove if the player gets too far away
* Changes AirSwipe streams to be independent of one another (i.e. one hitting a wall won't cause them all to stop)
* Reduces the default collision radius of AirSwipe and prevents entities from getting hit through corners
* Bumps the Spigot API version to 1.16
This commit is contained in:
Christopher Martin 2020-07-19 16:37:50 -07:00 committed by GitHub
parent 3c0424db51
commit 8d7f116c49
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 145 additions and 49 deletions

View file

@ -266,12 +266,12 @@ public class BendingPlayer {
return false; return false;
} }
if (!ignoreCooldowns && this.cooldowns.containsKey(this.name)) { if (!ignoreCooldowns && this.cooldowns.containsKey(ability.getName())) {
if (this.cooldowns.get(this.name).getCooldown() + getConfig().getLong("Properties.GlobalCooldown") >= System.currentTimeMillis()) { if (this.cooldowns.get(ability.getName()).getCooldown() + getConfig().getLong("Properties.GlobalCooldown") >= System.currentTimeMillis()) {
return false; 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()) { if (this.isChiBlocked() || this.isParalyzed() || (this.isBloodbent() && !ability.getName().equalsIgnoreCase("AvatarState")) || this.isControlledByMetalClips()) {

View file

@ -179,6 +179,7 @@ import com.projectkorra.projectkorra.waterbending.Torrent;
import com.projectkorra.projectkorra.waterbending.WaterBubble; import com.projectkorra.projectkorra.waterbending.WaterBubble;
import com.projectkorra.projectkorra.waterbending.WaterManipulation; import com.projectkorra.projectkorra.waterbending.WaterManipulation;
import com.projectkorra.projectkorra.waterbending.WaterSpout; import com.projectkorra.projectkorra.waterbending.WaterSpout;
import com.projectkorra.projectkorra.waterbending.WaterSpoutWave;
import com.projectkorra.projectkorra.waterbending.blood.Bloodbending; import com.projectkorra.projectkorra.waterbending.blood.Bloodbending;
import com.projectkorra.projectkorra.waterbending.combo.IceBullet; import com.projectkorra.projectkorra.waterbending.combo.IceBullet;
import com.projectkorra.projectkorra.waterbending.healing.HealingWaters; import com.projectkorra.projectkorra.waterbending.healing.HealingWaters;
@ -236,6 +237,8 @@ public class PKListener implements Listener {
ability = CoreAbility.getAbility(SurgeWall.class); ability = CoreAbility.getAbility(SurgeWall.class);
} else if (abil != null && abil.equalsIgnoreCase("Torrent")) { } else if (abil != null && abil.equalsIgnoreCase("Torrent")) {
ability = CoreAbility.getAbility(Torrent.class); ability = CoreAbility.getAbility(Torrent.class);
} else if (abil != null && abil.equalsIgnoreCase("WaterSpout")) {
ability = CoreAbility.getAbility(WaterSpoutWave.class);
} else { } else {
ability = CoreAbility.getAbility(abil); ability = CoreAbility.getAbility(abil);
} }

View file

@ -786,9 +786,7 @@ public abstract class CoreAbility implements Ability {
} }
String tag = null; String tag = null;
if (this instanceof ComboAbility) { if (this instanceof PassiveAbility) {
tag = "Abilities." + elementName + "." + elementName + "Combo." + this.getName() + ".Enabled";
} else if (this instanceof PassiveAbility) {
tag = "Abilities." + elementName + ".Passive." + this.getName() + ".Enabled"; tag = "Abilities." + elementName + ".Passive." + this.getName() + ".Enabled";
} else { } else {
tag = "Abilities." + elementName + "." + this.getName() + ".Enabled"; tag = "Abilities." + elementName + "." + this.getName() + ".Enabled";

View file

@ -245,6 +245,19 @@ public class AirSuction extends AirAbility {
this.advanceLocation(); this.advanceLocation();
} else { } 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); playAirbendingParticles(this.origin, 5, 0.5, 0.5, 0.5);
} }
} }

View file

@ -57,7 +57,7 @@ public class AirSwipe extends AirAbility {
private double maxChargeFactor; private double maxChargeFactor;
private Location origin; private Location origin;
private Random random; private Random random;
private Map<Vector, Location> elements; private Map<Vector, Location> streams;
private ArrayList<Entity> affectedEntities; private ArrayList<Entity> affectedEntities;
public AirSwipe(final Player player) { public AirSwipe(final Player player) {
@ -91,7 +91,7 @@ public class AirSwipe extends AirAbility {
this.radius = getConfig().getDouble("Abilities.Air.AirSwipe.Radius"); this.radius = getConfig().getDouble("Abilities.Air.AirSwipe.Radius");
this.maxChargeFactor = getConfig().getDouble("Abilities.Air.AirSwipe.ChargeFactor"); this.maxChargeFactor = getConfig().getDouble("Abilities.Air.AirSwipe.ChargeFactor");
this.random = new Random(); this.random = new Random();
this.elements = new ConcurrentHashMap<>(); this.streams = new ConcurrentHashMap<>();
this.affectedEntities = new ArrayList<>(); this.affectedEntities = new ArrayList<>();
if (this.bPlayer.isOnCooldown(this) || player.getEyeLocation().getBlock().isLiquid()) { 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) { public static boolean removeSwipesAroundPoint(final Location loc, final double radius) {
boolean removed = false; boolean removed = false;
for (final AirSwipe aswipe : getAbilities(AirSwipe.class)) { for (final AirSwipe aswipe : getAbilities(AirSwipe.class)) {
for (final Vector vec : aswipe.elements.keySet()) { for (final Vector vec : aswipe.streams.keySet()) {
final Location vectorLoc = aswipe.elements.get(vec); final Location vectorLoc = aswipe.streams.get(vec);
if (vectorLoc != null && vectorLoc.getWorld().equals(loc.getWorld())) { if (vectorLoc != null && vectorLoc.getWorld().equals(loc.getWorld())) {
if (vectorLoc.distanceSquared(loc) <= radius * radius) { if (vectorLoc.distanceSquared(loc) <= radius * radius) {
aswipe.remove(); aswipe.remove();
@ -142,19 +142,19 @@ public class AirSwipe extends AirAbility {
private void advanceSwipe() { private void advanceSwipe() {
this.affectedEntities.clear(); this.affectedEntities.clear();
for (final Vector direction : this.elements.keySet()) { for (final Vector direction : this.streams.keySet()) {
Location location = this.elements.get(direction); Location location = this.streams.get(direction);
if (direction != null && location != null) { if (direction != null && location != null) {
location = location.clone().add(direction.clone().multiply(this.speed)); 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)) { if (location.distanceSquared(this.origin) > this.range * this.range || GeneralMethods.isRegionProtectedFromBuild(this, location)) {
this.elements.clear(); this.streams.clear();
} else { } else {
final Block block = location.getBlock(); final Block block = location.getBlock();
if (!ElementalAbility.isTransparent(this.player, block)) { if (!ElementalAbility.isTransparent(this.player, block)) {
this.remove(); this.streams.remove(direction);
return; continue;
} }
for (final Block testblock : GeneralMethods.getBlocksAroundPoint(location, this.radius)) { for (final Block testblock : GeneralMethods.getBlocksAroundPoint(location, this.radius)) {
@ -169,7 +169,7 @@ public class AirSwipe extends AirAbility {
} else if (isPlant(block.getType())) { } else if (isPlant(block.getType())) {
block.breakNaturally(); block.breakNaturally();
} else { } else {
this.elements.remove(direction); this.streams.remove(direction);
} }
if (isLava(block)) { if (isLava(block)) {
if (LavaFlow.isLavaFlowBlock(block)) { if (LavaFlow.isLavaFlowBlock(block)) {
@ -190,7 +190,7 @@ public class AirSwipe extends AirAbility {
} }
} }
} }
if (this.elements.isEmpty()) { if (this.streams.isEmpty()) {
this.remove(); this.remove();
} }
} }
@ -199,6 +199,14 @@ public class AirSwipe extends AirAbility {
final List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, this.radius); final List<Entity> entities = GeneralMethods.getEntitiesAroundPoint(location, this.radius);
final Vector fDirection = direction.clone(); 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++) { for (int i = 0; i < entities.size(); i++) {
final Entity entity = entities.get(i); final Entity entity = entities.get(i);
final AirSwipe abil = this; final AirSwipe abil = this;
@ -226,7 +234,7 @@ public class AirSwipe extends AirAbility {
AirSwipe.this.affectedEntities.add(entity); AirSwipe.this.affectedEntities.add(entity);
} }
breakBreathbendingHold(entity); breakBreathbendingHold(entity);
AirSwipe.this.elements.remove(direction); AirSwipe.this.streams.remove(direction);
} else if (entity.getEntityId() != AirSwipe.this.player.getEntityId() && !(entity instanceof LivingEntity)) { } else if (entity.getEntityId() != AirSwipe.this.player.getEntityId() && !(entity instanceof LivingEntity)) {
GeneralMethods.setVelocity(entity, fDirection.multiply(AirSwipe.this.pushFactor)); GeneralMethods.setVelocity(entity, fDirection.multiply(AirSwipe.this.pushFactor));
@ -254,7 +262,7 @@ public class AirSwipe extends AirAbility {
direction.setX(vx); direction.setX(vx);
direction.setZ(vz); 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.charging) {
if (this.elements.isEmpty()) { if (this.streams.isEmpty()) {
this.remove(); this.remove();
return; return;
} }
@ -303,7 +311,7 @@ public class AirSwipe extends AirAbility {
@Override @Override
public Location getLocation() { 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 @Override
@ -334,7 +342,7 @@ public class AirSwipe extends AirAbility {
@Override @Override
public List<Location> getLocations() { public List<Location> getLocations() {
final ArrayList<Location> locations = new ArrayList<>(); final ArrayList<Location> locations = new ArrayList<>();
for (final Location swipeLoc : this.elements.values()) { for (final Location swipeLoc : this.streams.values()) {
locations.add(swipeLoc); locations.add(swipeLoc);
} }
return locations; return locations;
@ -433,7 +441,7 @@ public class AirSwipe extends AirAbility {
} }
public Map<Vector, Location> getElements() { public Map<Vector, Location> getElements() {
return this.elements; return this.streams;
} }
public ArrayList<Entity> getAffectedEntities() { public ArrayList<Entity> getAffectedEntities() {

View file

@ -686,7 +686,7 @@ public class ConfigManager {
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Damage", 4.5); 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.Push", 1.0);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirSwipe.Range", 24); 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.ChargeTime", 1000);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.Damage", 3); config.addDefault("Abilities.Avatar.AvatarState.Air.AirBurst.Damage", 3);
config.addDefault("Abilities.Avatar.AvatarState.Air.AirShield.IsAvatarStateToggle", true); 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.Enabled", true);
config.addDefault("Abilities.Air.AirSwipe.Damage", 2); config.addDefault("Abilities.Air.AirSwipe.Damage", 2);
config.addDefault("Abilities.Air.AirSwipe.Range", 14); 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.Push", 0.5);
config.addDefault("Abilities.Air.AirSwipe.Arc", 16); config.addDefault("Abilities.Air.AirSwipe.Arc", 16);
config.addDefault("Abilities.Air.AirSwipe.Speed", 25); 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.MaxFreezeRadius", 7);
config.addDefault("Abilities.Water.Surge.Wave.Cooldown", 500); config.addDefault("Abilities.Water.Surge.Wave.Cooldown", 500);
config.addDefault("Abilities.Water.Surge.Wave.Interval", 30); 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.Range", 5);
config.addDefault("Abilities.Water.Surge.Wall.Radius", 2); config.addDefault("Abilities.Water.Surge.Wall.Radius", 2);
config.addDefault("Abilities.Water.Surge.Wall.Cooldown", 0); config.addDefault("Abilities.Water.Surge.Wall.Cooldown", 0);
config.addDefault("Abilities.Water.Surge.Wall.Duration", 0); config.addDefault("Abilities.Water.Surge.Wall.Duration", 0);
config.addDefault("Abilities.Water.Surge.Wall.Interval", 30); 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.Surge.Wave.IceRevertTime", 60000);
config.addDefault("Abilities.Water.Torrent.Enabled", true); config.addDefault("Abilities.Water.Torrent.Enabled", true);

View file

@ -39,6 +39,10 @@ public class DensityShift extends EarthAbility implements PassiveAbility {
} }
if (ElementalAbility.isEarth(block)) { if (ElementalAbility.isEarth(block)) {
if ((player.getLocation().getY() % 1) != 0) {
return true;
}
for (final Block affectedBlock : GeneralMethods.getBlocksAroundPoint(block.getLocation(), 2)) { for (final Block affectedBlock : GeneralMethods.getBlocksAroundPoint(block.getLocation(), 2)) {
if (ElementalAbility.isEarth(affectedBlock)) { if (ElementalAbility.isEarth(affectedBlock)) {
if (GeneralMethods.isSolid(affectedBlock.getRelative(BlockFace.DOWN))) { if (GeneralMethods.isSolid(affectedBlock.getRelative(BlockFace.DOWN))) {

View file

@ -236,6 +236,9 @@ public class OctopusForm extends WaterAbility {
this.bPlayer.addCooldown(this); this.bPlayer.addCooldown(this);
this.remove(); this.remove();
return; return;
} else if (!isWaterbendable(this.sourceBlock) && !this.settingUp && !this.forming && !this.formed) {
this.remove();
return;
} }
final Random random = new Random(); final Random random = new Random();

View file

@ -10,7 +10,10 @@ import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.data.Levelled;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -39,12 +42,14 @@ public class SurgeWall extends WaterAbility {
private boolean settingUp; private boolean settingUp;
private boolean forming; private boolean forming;
private boolean frozen; private boolean frozen;
private boolean solidifyLava;
private long time; private long time;
private long interval; private long interval;
@Attribute(Attribute.COOLDOWN) @Attribute(Attribute.COOLDOWN)
private long cooldown; private long cooldown;
@Attribute(Attribute.DURATION) @Attribute(Attribute.DURATION)
private long duration; private long duration;
private long obsidianDuration;
@Attribute(Attribute.RADIUS) @Attribute(Attribute.RADIUS)
private double radius; private double radius;
@Attribute(Attribute.RANGE) @Attribute(Attribute.RANGE)
@ -66,6 +71,8 @@ public class SurgeWall extends WaterAbility {
this.duration = getConfig().getLong("Abilities.Water.Surge.Wall.Duration"); this.duration = getConfig().getLong("Abilities.Water.Surge.Wall.Duration");
this.range = getConfig().getDouble(RANGE_CONFIG); this.range = getConfig().getDouble(RANGE_CONFIG);
this.radius = getConfig().getDouble("Abilities.Water.Surge.Wall.Radius"); 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.locations = new ArrayList<>();
this.oldTemps = new HashMap<>(); this.oldTemps = new HashMap<>();
@ -102,7 +109,7 @@ public class SurgeWall extends WaterAbility {
final Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock(); final Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock();
if (isTransparent(player, block) && isTransparent(player, eyeLoc.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); SOURCE_BLOCKS.add(tempBlock);
wave = new SurgeWave(player); wave = new SurgeWave(player);
@ -145,7 +152,7 @@ public class SurgeWall extends WaterAbility {
this.frozen = false; this.frozen = false;
for (final Block block : WALL_BLOCKS.keySet()) { for (final Block block : WALL_BLOCKS.keySet()) {
if (WALL_BLOCKS.get(block) == this.player) { 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.bPlayer.addCooldown(this);
this.remove(); this.remove();
return; return;
} else if (!isWaterbendable(this.sourceBlock) && !this.settingUp && !this.forming && !this.progressing) {
remove();
return;
} }
this.locations.clear(); this.locations.clear();
if (System.currentTimeMillis() - this.time >= this.interval) { 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)) { if (WALL_BLOCKS.get(blocki) == this.player && !blocks.contains(blocki)) {
this.finalRemoveWater(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; return;
} }
@ -334,7 +364,7 @@ public class SurgeWall extends WaterAbility {
if (this.frozen) { if (this.frozen) {
new TempBlock(block, Material.ICE); new TempBlock(block, Material.ICE);
} else { } 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())) { if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
return; return;
} else if (!TempBlock.isTempBlock(block)) { } else if (!TempBlock.isTempBlock(block)) {
new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); new TempBlock(block, Material.WATER);
AFFECTED_BLOCKS.put(block, block); AFFECTED_BLOCKS.put(block, block);
} }
} }
@ -443,7 +473,7 @@ public class SurgeWall extends WaterAbility {
final Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock(); final Block block = eyeLoc.add(eyeLoc.getDirection().normalize()).getBlock();
if (isTransparent(player, block) && isTransparent(player, eyeLoc.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); SOURCE_BLOCKS.add(tempBlock);
wall = new SurgeWall(player); wall = new SurgeWall(player);

View file

@ -9,7 +9,10 @@ import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Effect; import org.bukkit.Effect;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block; 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.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -17,8 +20,6 @@ import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.AirAbility; 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.ability.WaterAbility;
import com.projectkorra.projectkorra.attribute.Attribute; import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.avatar.AvatarState; import com.projectkorra.projectkorra.avatar.AvatarState;
@ -37,12 +38,14 @@ public class SurgeWave extends WaterAbility {
private boolean activateFreeze; private boolean activateFreeze;
private boolean progressing; private boolean progressing;
private boolean canHitSelf; private boolean canHitSelf;
private boolean solidifyLava;
private long time; private long time;
@Attribute(Attribute.COOLDOWN) @Attribute(Attribute.COOLDOWN)
private long cooldown; private long cooldown;
private long interval; private long interval;
@Attribute("IceRevertTime") @Attribute("IceRevertTime")
private long iceRevertTime; private long iceRevertTime;
private long obsidianDuration;
private double currentRadius; private double currentRadius;
@Attribute(Attribute.RADIUS) @Attribute(Attribute.RADIUS)
private double maxRadius; private double maxRadius;
@ -86,6 +89,8 @@ public class SurgeWave extends WaterAbility {
this.iceRevertTime = getConfig().getLong("Abilities.Water.Surge.Wave.IceRevertTime"); this.iceRevertTime = getConfig().getLong("Abilities.Water.Surge.Wave.IceRevertTime");
this.range = getConfig().getDouble("Abilities.Water.Surge.Wave.Range"); this.range = getConfig().getDouble("Abilities.Water.Surge.Wave.Range");
this.selectRange = getConfig().getDouble("Abilities.Water.Surge.Wave.SelectRange"); 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.waveBlocks = new ConcurrentHashMap<>();
this.frozenBlocks = new ConcurrentHashMap<>(); this.frozenBlocks = new ConcurrentHashMap<>();
@ -108,7 +113,7 @@ public class SurgeWave extends WaterAbility {
if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) { if (GeneralMethods.isRegionProtectedFromBuild(this, block.getLocation())) {
return; return;
} else if (!TempBlock.isTempBlock(block)) { } else if (!TempBlock.isTempBlock(block)) {
new TempBlock(block, Material.WATER, GeneralMethods.getWaterData(0)); new TempBlock(block, Material.WATER);
this.waveBlocks.put(block, block); this.waveBlocks.put(block, block);
} }
} }
@ -270,6 +275,9 @@ public class SurgeWave extends WaterAbility {
if (!this.bPlayer.canBendIgnoreBindsCooldowns(this)) { if (!this.bPlayer.canBendIgnoreBindsCooldowns(this)) {
this.remove(); this.remove();
return; return;
} else if (!isWaterbendable(this.sourceBlock) && !this.progressing) {
this.remove();
return;
} }
if (System.currentTimeMillis() - this.time >= this.interval) { if (System.currentTimeMillis() - this.time >= this.interval) {
@ -316,6 +324,24 @@ public class SurgeWave extends WaterAbility {
if (!blocks.contains(block)) { if (!blocks.contains(block)) {
this.finalRemoveWater(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) { for (final Block block : blocks) {
if (!this.waveBlocks.containsKey(block)) { if (!this.waveBlocks.containsKey(block)) {

View file

@ -171,6 +171,9 @@ public class Torrent extends WaterAbility {
if (!this.bPlayer.canBendIgnoreCooldowns(this)) { if (!this.bPlayer.canBendIgnoreCooldowns(this)) {
this.remove(); this.remove();
return; return;
} else if (!isWaterbendable(this.sourceBlock) && !this.settingUp && !this.forming && !this.formed && !this.launching) {
this.remove();
return;
} }
if (System.currentTimeMillis() > this.time + this.interval) { if (System.currentTimeMillis() > this.time + this.interval) {
@ -207,7 +210,7 @@ public class Torrent extends WaterAbility {
this.sourceBlock.setType(Material.AIR); 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(); this.location = this.sourceBlock.getLocation();
} else { } else {
playFocusWaterEffect(this.sourceBlock); playFocusWaterEffect(this.sourceBlock);
@ -261,7 +264,7 @@ public class Torrent extends WaterAbility {
this.remove(); this.remove();
return; 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()) { if (this.forming && !this.player.isSneaking()) {
@ -354,7 +357,7 @@ public class Torrent extends WaterAbility {
final Block block = blockloc.getBlock(); final Block block = blockloc.getBlock();
if (!doneBlocks.contains(block) && !GeneralMethods.isRegionProtectedFromBuild(this, blockloc)) { if (!doneBlocks.contains(block) && !GeneralMethods.isRegionProtectedFromBuild(this, blockloc)) {
if (isTransparent(this.player, block)) { 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); doneBlocks.add(block);
} else if (!isTransparent(this.player, block)) { } else if (!isTransparent(this.player, block)) {
break; break;
@ -422,7 +425,7 @@ public class Torrent extends WaterAbility {
if (isWater(locBlock)) { if (isWater(locBlock)) {
ParticleEffect.WATER_BUBBLE.display(locBlock.getLocation().clone().add(.5, .5, .5), 5, Math.random(), Math.random(), Math.random(), 0); 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 { } else {
if (this.layer < this.maxLayer) { if (this.layer < this.maxLayer) {
if (this.layer == 0) { if (this.layer == 0) {
@ -487,7 +490,7 @@ public class Torrent extends WaterAbility {
final Block block = blockLoc.getBlock(); final Block block = blockLoc.getBlock();
if (!doneBlocks.contains(block)) { if (!doneBlocks.contains(block)) {
if (isTransparent(this.player, 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); doneBlocks.add(block);
for (final Entity entity : entities) { for (final Entity entity : entities) {
if (entity.getWorld() != blockLoc.getWorld()) { if (entity.getWorld() != blockLoc.getWorld()) {

View file

@ -74,6 +74,7 @@ public class WaterSpoutWave extends WaterAbility {
private double animationSpeed; private double animationSpeed;
private AbilityType type; private AbilityType type;
private AnimateState animation; private AnimateState animation;
private Block sourceBlock;
private Vector direction; private Vector direction;
private Location origin; private Location origin;
private Location location; private Location location;
@ -163,30 +164,30 @@ public class WaterSpoutWave extends WaterAbility {
if (this.type == AbilityType.CLICK) { if (this.type == AbilityType.CLICK) {
if (this.origin == null) { if (this.origin == null) {
this.removeOldType(this.player, AbilityType.CLICK); 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(); this.remove();
return; return;
} }
final Block blockAbove = block.getRelative(BlockFace.UP); final Block blockAbove = this.sourceBlock.getRelative(BlockFace.UP);
if (!ElementalAbility.isAir(blockAbove.getType()) && !this.isWaterbendable(blockAbove)) { if (!ElementalAbility.isAir(blockAbove.getType()) && !this.isWaterbendable(blockAbove)) {
this.remove(); this.remove();
return; return;
} }
this.origin = block.getLocation(); this.origin = this.sourceBlock.getLocation();
if (!this.isWaterbendable(block) || GeneralMethods.isRegionProtectedFromBuild(this, this.origin)) { if (!this.isWaterbendable(this.sourceBlock) || GeneralMethods.isRegionProtectedFromBuild(this, this.origin)) {
this.remove(); this.remove();
return; return;
} else if (this.iceOnly && !(this.isIcebendable(block) || isSnow(block))) { } else if (this.iceOnly && !(this.isIcebendable(this.sourceBlock) || isSnow(this.sourceBlock))) {
this.remove(); this.remove();
return; 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(); this.remove();
return; return;
} else if (this.player.isSneaking()) { } else if (this.player.isSneaking()) {
@ -306,7 +307,7 @@ public class WaterSpoutWave extends WaterAbility {
if (this.iceWave) { if (this.iceWave) {
this.createBlockDelay(block, Material.ICE, Material.ICE.createBlockData(), 2L); this.createBlockDelay(block, Material.ICE, Material.ICE.createBlockData(), 2L);
} else { } 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(); final Block block = this.player.getEyeLocation().add(dir).getBlock();
this.location = block.getLocation(); this.location = block.getLocation();
if (ElementalAbility.isAir(block.getType()) && !GeneralMethods.isRegionProtectedFromBuild(this, 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);
} }
} }
} }

View file

@ -157,6 +157,9 @@ public class IceSpikeBlast extends IceAbility {
} else if (!this.bPlayer.getBoundAbilityName().equals(this.getName()) && this.prepared) { } else if (!this.bPlayer.getBoundAbilityName().equals(this.getName()) && this.prepared) {
this.remove(); this.remove();
return; return;
} else if (!isWaterbendable(this.sourceBlock) && !this.progressing && !this.settingUp) {
this.remove();
return;
} }
if (System.currentTimeMillis() < this.time + this.interval) { if (System.currentTimeMillis() < this.time + this.interval) {

View file

@ -1,6 +1,6 @@
name: ProjectKorra name: ProjectKorra
author: ProjectKorra author: ProjectKorra
api-version: 1.13 api-version: 1.16
version: ${project.version} version: ${project.version}
main: com.projectkorra.projectkorra.ProjectKorra main: com.projectkorra.projectkorra.ProjectKorra
softdepend: [PreciousStones, WorldGuard, WorldEdit, FactionsFramework, GriefPrevention, Towny, NoCheatPlus, LWC, Residence, Kingdoms, RedProtect, PlaceholderAPI] softdepend: [PreciousStones, WorldGuard, WorldEdit, FactionsFramework, GriefPrevention, Towny, NoCheatPlus, LWC, Residence, Kingdoms, RedProtect, PlaceholderAPI]