Merge branch '1.13' into update/configuration

This commit is contained in:
jayoevans 2019-10-23 16:31:10 +10:00
commit 2d4654a18b
23 changed files with 234 additions and 182 deletions

View file

@ -48,6 +48,7 @@ import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.TNTPrimed;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.MainHand;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -725,12 +726,12 @@ public class GeneralMethods {
*/
public static Entity getClosestEntity(Location center, double radius) {
Entity found = null;
double distance = radius * radius;
Double distance = null;
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
double check = center.distance(entity.getLocation());
double check = center.distanceSquared(entity.getLocation());
if (check < distance) {
if (distance == null || check < distance) {
found = entity;
distance = check;
}
@ -747,12 +748,12 @@ public class GeneralMethods {
*/
public static LivingEntity getClosestLivingEntity(Location center, double radius) {
LivingEntity le = null;
double distance = radius * radius;
Double distance = null;
for (Entity entity : GeneralMethods.getEntitiesAroundPoint(center, radius)) {
double check = center.distance(entity.getLocation());
double check = center.distanceSquared(entity.getLocation());
if (entity instanceof LivingEntity && check < distance) {
if (entity instanceof LivingEntity && (distance == null || check < distance)) {
le = (LivingEntity) entity;
distance = check;
}
@ -962,6 +963,16 @@ public class GeneralMethods {
return location.clone().subtract(new Vector(Math.cos(angle), 0, Math.sin(angle)).normalize().multiply(distance));
}
public static Location getMainHandLocation(final Player player) {
Location loc;
if (player.getMainHand() == MainHand.LEFT) {
loc = GeneralMethods.getLeftSide(player.getLocation(), .55).add(0, 1.2, 0);
} else {
loc = GeneralMethods.getRightSide(player.getLocation(), .55).add(0, 1.2, 0);
}
return loc;
}
public static Plugin getProbending() {
if (hasProbending()) {
return Bukkit.getServer().getPluginManager().getPlugin("Probending");
@ -1032,7 +1043,7 @@ public class GeneralMethods {
return getTargetedEntity(player, range, new ArrayList<Entity>());
}
public static Location getTargetedLocation(final Player player, final double range, final boolean ignoreTempBlocks, final Material... nonOpaque2) {
public static Location getTargetedLocation(final Player player, final double range, final boolean ignoreTempBlocks, final boolean checkDiagonals, final Material... nonOpaque2) {
final Location origin = player.getEyeLocation();
final Vector direction = origin.getDirection();
@ -1053,6 +1064,11 @@ public class GeneralMethods {
for (double i = 0; i < range; i += 0.2) {
location.add(vec);
if (checkDiagonals && checkDiagonalWall(location, vec)) {
location.subtract(vec);
break;
}
final Block block = location.getBlock();
if (trans.contains(block.getType())) {
@ -1068,12 +1084,16 @@ public class GeneralMethods {
return location;
}
public static Location getTargetedLocation(final Player player, final double range, final boolean ignoreTempBlocks, final Material... nonOpaque2) {
return getTargetedLocation(player, range, ignoreTempBlocks, true, nonOpaque2);
}
public static Location getTargetedLocation(final Player player, final double range, final Material... nonOpaque2) {
return getTargetedLocation(player, range, false, nonOpaque2);
}
public static Location getTargetedLocation(final Player player, final int range) {
return getTargetedLocation(player, range, Material.AIR);
return getTargetedLocation(player, range, false);
}
public static Block getTopBlock(final Location loc, final int range) {

View file

@ -563,10 +563,10 @@ public abstract class EarthAbility<C extends AbilityConfig> extends ElementalAbi
if (block.equals(sourceblock)) {
info.getState().update(true, false);
if (RaiseEarth.blockInAllAffectedBlocks(sourceblock)) {
EarthAbility.revertBlock(sourceblock);
RaiseEarth.revertAffectedBlock(sourceblock);
}
if (RaiseEarth.blockInAllAffectedBlocks(block)) {
EarthAbility.revertBlock(block);
RaiseEarth.revertAffectedBlock(block);
}
MOVED_EARTH.remove(block);
return true;
@ -595,10 +595,10 @@ public abstract class EarthAbility<C extends AbilityConfig> extends ElementalAbi
}
if (RaiseEarth.blockInAllAffectedBlocks(sourceblock)) {
EarthAbility.revertBlock(sourceblock);
RaiseEarth.revertAffectedBlock(sourceblock);
}
if (RaiseEarth.blockInAllAffectedBlocks(block)) {
EarthAbility.revertBlock(block);
RaiseEarth.revertAffectedBlock(block);
}
MOVED_EARTH.remove(block);
}

View file

@ -213,13 +213,24 @@ public class AirBlast extends AirAbility<AirBlastConfig> {
}
private void affect(final Entity entity) {
final boolean isUser = entity.getUniqueId() == this.player.getUniqueId();
if (entity instanceof Player) {
if (Commands.invincible.contains(((Player) entity).getName())) {
return;
}
}
final boolean isUser = entity.getUniqueId() == this.player.getUniqueId();
double knockback = this.pushFactorForOthers;
if (isUser) {
if (isFromOtherOrigin) {
knockback = this.pushFactor;
} else {
return;
}
}
if (!isUser || this.isFromOtherOrigin) {
this.pushFactor = this.pushFactorForOthers;
final Vector velocity = entity.getVelocity();
final double max = this.speed / this.speedFactor;
double factor = this.pushFactor;
final Vector push = this.direction.clone();
if (Math.abs(push.getY()) > max && !isUser) {
@ -229,56 +240,45 @@ public class AirBlast extends AirAbility<AirBlastConfig> {
push.setY(max);
}
}
if (this.location.getWorld().equals(this.origin.getWorld())) {
factor *= 1 - this.location.distance(this.origin) / (2 * this.range);
knockback *= 1 - this.location.distance(this.origin) / (2 * this.range);
}
if (isUser && GeneralMethods.isSolid(this.player.getLocation().add(0, -.5, 0).getBlock())) {
factor *= .5;
if (GeneralMethods.isSolid(entity.getLocation().add(0, -0.5, 0).getBlock()) && source == null) {
knockback *= 0.85;
}
final double comp = velocity.dot(push.clone().normalize());
if (comp > factor) {
velocity.multiply(.5);
velocity.add(push.clone().normalize().multiply(velocity.clone().dot(push.clone().normalize())));
} else if (comp + factor * .5 > factor) {
velocity.add(push.clone().multiply(factor - comp));
} else {
velocity.add(push.clone().multiply(factor * .5));
push.normalize().multiply(knockback);
if (Math.abs(entity.getVelocity().dot(push)) > knockback && entity.getVelocity().angle(push) > Math.PI / 3) {
push.normalize().add(entity.getVelocity()).multiply(knockback);
}
if (entity instanceof Player) {
if (Commands.invincible.contains(((Player) entity).getName())) {
return;
}
}
GeneralMethods.setVelocity(entity, push);
if (Double.isNaN(velocity.length())) {
return;
}
GeneralMethods.setVelocity(entity, velocity);
if (this.source != null) {
new HorizontalVelocityTracker(entity, this.player, 200l, this.source);
} else {
new HorizontalVelocityTracker(entity, this.player, 200l, this);
}
if (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(this.player) && !this.affectedEntities.contains(entity)) {
if (this.source != null) {
DamageHandler.damageEntity(entity, this.damage, this.source);
} else {
DamageHandler.damageEntity(entity, this.damage, this);
}
this.affectedEntities.add(entity);
}
if (entity.getFireTicks() > 0) {
entity.getWorld().playEffect(entity.getLocation(), Effect.EXTINGUISH, 0);
}
entity.setFireTicks(0);
breakBreathbendingHold(entity);
if (this.source != null && (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(this.player) && !this.affectedEntities.contains(entity))) {
DamageHandler.damageEntity(entity, this.damage, this.source);
this.affectedEntities.add(entity);
} else if (this.source == null && (this.damage > 0 && entity instanceof LivingEntity && !entity.equals(this.player) && !this.affectedEntities.contains(entity))) {
DamageHandler.damageEntity(entity, this.damage, this);
this.affectedEntities.add(entity);
}
}
}
@Override

View file

@ -325,10 +325,6 @@ public class AirBurst extends AirAbility<AirBurstConfig> {
return this.blasts;
}
public ArrayList<Entity> getAffectedEntities() {
return this.affectedEntities;
}
@Override
public Class<AirBurstConfig> getConfigType() {
return AirBurstConfig.class;

View file

@ -44,6 +44,8 @@ public class AirSuction extends AirAbility<AirSuctionConfig> {
private double radius;
@Attribute(Attribute.KNOCKBACK)
private double pushFactor;
@Attribute(Attribute.KNOCKBACK + "Others")
private double pushFactorForOthers;
private Random random;
private Location location;
private Location origin;
@ -78,7 +80,8 @@ public class AirSuction extends AirAbility<AirSuctionConfig> {
this.speed = config.Speed;
this.range = config.Range;
this.radius = config.Radius;
this.pushFactor = config.PushFactor;
this.pushFactor = config.PushFactor_Self;
this.pushFactorForOthers = config.PushFactor_Others;
this.cooldown = config.Cooldown;
this.random = new Random();
this.origin = this.getTargetLocation();
@ -203,10 +206,15 @@ public class AirSuction extends AirAbility<AirSuctionConfig> {
if ((entity.getEntityId() == this.player.getEntityId()) && !this.canAffectSelf) {
continue;
}
final Vector velocity = entity.getVelocity();
double knockback = this.pushFactor;
if (entity.getEntityId() != player.getEntityId()) {
knockback = this.pushFactorForOthers;
}
final double max = this.speed;
final Vector push = this.direction.clone();
double factor = this.pushFactor;
if (Math.abs(push.getY()) > max) {
if (push.getY() < 0) {
@ -217,20 +225,16 @@ public class AirSuction extends AirAbility<AirSuctionConfig> {
}
if (this.location.getWorld().equals(this.origin.getWorld())) {
factor *= 1 - this.location.distance(this.origin) / (2 * this.range);
knockback *= 1 - this.location.distance(this.origin) / (2 * this.range);
}
final double comp = velocity.dot(push.clone().normalize());
if (comp > factor) {
velocity.multiply(.5);
velocity.add(push.clone().normalize().multiply(velocity.clone().dot(push.clone().normalize())));
} else if (comp + factor * .5 > factor) {
velocity.add(push.clone().multiply(factor - comp));
} else {
velocity.add(push.clone().multiply(factor * .5));
push.normalize().multiply(knockback);
if (Math.abs(entity.getVelocity().dot(push)) > knockback) {
push.normalize().add(entity.getVelocity()).multiply(knockback);
}
GeneralMethods.setVelocity(entity, velocity);
GeneralMethods.setVelocity(entity, push.normalize().multiply(knockback));
new HorizontalVelocityTracker(entity, this.player, 200l, this);
entity.setFallDistance(0);

View file

@ -78,7 +78,7 @@ public class AirSwipe extends AirAbility<AirSwipeConfig> {
}
this.charging = charging;
this.origin = player.getEyeLocation();
this.origin = GeneralMethods.getMainHandLocation(player);
this.particles = config.AnimationParticleAmount;
this.arc = config.Arc;
this.arcIncrement = config.StepSize;

View file

@ -143,7 +143,6 @@ public class Suffocate extends AirAbility<SuffocateConfig> {
}
}
this.bPlayer.addCooldown(this);
this.start();
}
@ -172,7 +171,7 @@ public class Suffocate extends AirAbility<SuffocateConfig> {
if (this.player.getWorld().equals(this.targets.get(0).getWorld())) {
dist = this.player.getEyeLocation().distance(this.targets.get(0).getEyeLocation());
}
final Location targetLoc = this.player.getEyeLocation().clone().add(this.player.getEyeLocation().getDirection().normalize().multiply(dist));
final Location targetLoc = GeneralMethods.getTargetedLocation(player, dist, false, getTransparentMaterials());
final List<Entity> ents = GeneralMethods.getEntitiesAroundPoint(targetLoc, this.constantAimRadius);
for (int i = 0; i < this.targets.size(); i++) {
@ -337,6 +336,7 @@ public class Suffocate extends AirAbility<SuffocateConfig> {
@Override
public void remove() {
super.remove();
this.bPlayer.addCooldown(this);
for (int i = 0; i < this.tasks.size(); i++) {
this.tasks.get(i).cancel();
this.tasks.remove(i);

View file

@ -3,6 +3,7 @@ package com.projectkorra.projectkorra.airbending.combo;
import java.util.ArrayList;
import java.util.List;
import com.projectkorra.projectkorra.object.HorizontalVelocityTracker;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
@ -133,22 +134,23 @@ public class AirSweep extends AirAbility<AirSweepConfig> implements ComboAbility
if (this.origin == null) {
this.direction = this.player.getEyeLocation().getDirection().normalize();
this.origin = this.player.getLocation().add(this.direction.clone().multiply(10));
this.origin = GeneralMethods.getMainHandLocation(player).add(this.direction.clone().multiply(10));
}
if (this.progressCounter < 8) {
return;
}
if (this.destination == null) {
this.destination = this.player.getLocation().add(this.player.getEyeLocation().getDirection().normalize().multiply(10));
this.destination = GeneralMethods.getMainHandLocation(player).add(GeneralMethods.getMainHandLocation(player).getDirection().normalize().multiply(10));
final Vector origToDest = GeneralMethods.getDirection(this.origin, this.destination);
final Location hand = GeneralMethods.getMainHandLocation(player);
for (double i = 0; i < 30; i++) {
final Location endLoc = this.origin.clone().add(origToDest.clone().multiply(i / 30));
if (GeneralMethods.locationEqualsIgnoreDirection(this.player.getLocation(), endLoc)) {
if (GeneralMethods.locationEqualsIgnoreDirection(hand, endLoc)) {
continue;
}
final Vector vec = GeneralMethods.getDirection(this.player.getLocation(), endLoc);
final Vector vec = GeneralMethods.getDirection(hand, endLoc);
final FireComboStream fs = new FireComboStream(this.player, this, vec, this.player.getLocation(), this.range, this.speed);
final FireComboStream fs = new FireComboStream(this.player, this, vec, hand, this.range, this.speed);
fs.setDensity(1);
fs.setSpread(0F);
fs.setUseNewParticles(true);
@ -193,17 +195,17 @@ public class AirSweep extends AirAbility<AirSweepConfig> implements ComboAbility
this.remove();
return;
}
if (!entity.equals(this.player) && !this.affectedEntities.contains(entity) && !(entity instanceof Player && Commands.invincible.contains(((Player) entity).getName()))) {
this.affectedEntities.add(entity);
if (!entity.equals(this.player) && !(entity instanceof Player && Commands.invincible.contains(((Player) entity).getName()))) {
if (this.knockback != 0) {
final Vector force = fstream.getDirection();
entity.setVelocity(force.multiply(this.knockback));
final Vector force = fstream.getLocation().getDirection();
GeneralMethods.setVelocity(entity, force.clone().multiply(this.knockback));
new HorizontalVelocityTracker(entity, this.player, 200l, this);
entity.setFallDistance(0);
}
if(!this.affectedEntities.contains(entity)) {
this.affectedEntities.add(entity);
if (this.damage != 0) {
if (entity instanceof LivingEntity) {
if (fstream.getAbility().getName().equalsIgnoreCase("AirSweep")) {
DamageHandler.damageEntity(entity, this.damage, this);
} else {
DamageHandler.damageEntity(entity, this.damage, this);
}
}

View file

@ -78,8 +78,19 @@ public class PresetCommand extends PKCommand<PresetCommandConfig> {
bPlayer = BendingPlayer.getBendingPlayer(player);
}
int page = 1;
String name = null;
if (args.size() == 1 && !Arrays.asList(listaliases).contains(args.get(0))){
this.help(sender, false);
} else if (args.size() >= 2) {
if (Arrays.asList(listaliases).contains(args.get(0))) {
page = Integer.parseInt(args.get(1));
} else {
name = args.get(1);
}
}
// bending preset list.
if (args.size() == 1) {
if (Arrays.asList(listaliases).contains(args.get(0)) && this.hasPermission(sender, "list")) {
boolean firstMessage = true;
@ -95,7 +106,7 @@ public class PresetCommand extends PKCommand<PresetCommandConfig> {
presetNames.add(preset.getName());
}
for (final String s : this.getPage(presetNames, ChatColor.GOLD + "Presets: ", 1, false)) {
for (final String s : this.getPage(presetNames, ChatColor.GOLD + "Presets: ", page, false)) {
if (firstMessage) {
GeneralMethods.sendBrandingMessage(sender, s);
firstMessage = false;
@ -105,14 +116,7 @@ public class PresetCommand extends PKCommand<PresetCommandConfig> {
}
return;
} else {
this.help(sender, false);
return;
}
}
final String name = args.get(1);
if (Arrays.asList(deletealiases).contains(args.get(0)) && this.hasPermission(sender, "delete")) { // bending preset delete name.
} else if (Arrays.asList(deletealiases).contains(args.get(0)) && this.hasPermission(sender, "delete")) { // bending preset delete name.
if (!Preset.presetExists(player, name)) {
GeneralMethods.sendBrandingMessage(sender, ChatColor.RED + this.noPresetName);
return;

View file

@ -11,6 +11,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.EarthAbility;
import com.projectkorra.projectkorra.attribute.Attribute;
@ -70,6 +71,9 @@ public class Catapult extends EarthAbility<CatapultConfig> {
private void moveEarth(final Vector apply, final Vector direction) {
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.origin, 2)) {
if (entity.getEntityId() != this.player.getEntityId()) {
if (GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation()) || ((entity instanceof Player) && Commands.invincible.contains(((Player) entity).getName()))) {
continue;
}
entity.setVelocity(apply);
}
}

View file

@ -99,7 +99,7 @@ public class Collapse extends EarthAbility<CollapseConfig> {
thisBlock = this.block.getWorld().getBlockAt(this.location.clone().add(this.direction.clone().multiply(-i)));
this.affectedBlocks.put(thisBlock, thisBlock);
if (RaiseEarth.blockInAllAffectedBlocks(thisBlock)) {
EarthAbility.revertBlock(thisBlock);
RaiseEarth.revertAffectedBlock(thisBlock);
}
}
}

View file

@ -5,6 +5,7 @@ import java.util.ArrayList;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -376,8 +377,12 @@ public class EarthBlast extends EarthAbility<EarthBlastConfig> {
this.firstDestination = this.location.clone();
if (this.destination.getY() - this.location.getY() > 2) {
this.firstDestination.setY(this.destination.getY() - 1);
} else {
} else if (this.location.getY() > player.getEyeLocation().getY() && this.location.getBlock().getRelative(BlockFace.UP).isPassable()) {
this.firstDestination.subtract(0, 2, 0);
} else if (this.location.getBlock().getRelative(BlockFace.UP).isPassable() && this.location.getBlock().getRelative(BlockFace.UP, 2).isPassable()) {
this.firstDestination.add(0, 2, 0);
} else {
this.firstDestination.add(GeneralMethods.getDirection(this.location, this.destination).normalize().setY(0));
}
if (this.destination.distanceSquared(this.location) <= 1) {

View file

@ -2,7 +2,6 @@ package com.projectkorra.projectkorra.earthbending;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.bukkit.Location;
@ -15,11 +14,10 @@ import com.projectkorra.projectkorra.attribute.Attribute;
import com.projectkorra.projectkorra.configuration.configs.abilities.earth.RaiseEarthConfig;
import com.projectkorra.projectkorra.util.BlockSource;
import com.projectkorra.projectkorra.util.ClickType;
import com.projectkorra.projectkorra.util.TempBlock;
public class RaiseEarth extends EarthAbility<RaiseEarthConfig> {
private static final Map<Block, Block> ALL_AFFECTED_BLOCKS = new ConcurrentHashMap<>();
private int distance;
@Attribute(Attribute.HEIGHT)
private int height;
@ -104,7 +102,7 @@ public class RaiseEarth extends EarthAbility<RaiseEarthConfig> {
private boolean canInstantiate() {
for (final Block block : this.affectedBlocks.keySet()) {
if (!this.isEarthbendable(block) || ALL_AFFECTED_BLOCKS.containsKey(block)) {
if (!this.isEarthbendable(block) || TempBlock.isTempBlock(block)) {
return false;
}
}
@ -143,11 +141,15 @@ public class RaiseEarth extends EarthAbility<RaiseEarthConfig> {
}
public static boolean blockInAllAffectedBlocks(final Block block) {
return ALL_AFFECTED_BLOCKS.containsKey(block);
for (RaiseEarth raiseEarth : getAbilities(RaiseEarth.class)) {
if (raiseEarth.affectedBlocks.contains(block)) {
return true;
}
}
return false;
}
public static void revertAffectedBlock(final Block block) {
ALL_AFFECTED_BLOCKS.remove(block);
for (final RaiseEarth raiseEarth : getAbilities(RaiseEarth.class)) {
raiseEarth.affectedBlocks.remove(block);
}

View file

@ -18,6 +18,7 @@ import org.bukkit.entity.Zombie;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import com.projectkorra.projectkorra.command.Commands;
import com.projectkorra.projectkorra.GeneralMethods;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.ability.MetalAbility;
@ -166,7 +167,7 @@ public class MetalClips extends MetalAbility<MetalClipsConfig> {
return;
} else if (this.metalClipsCount == 3 && !this.canUse4Clips) {
return;
} else if (this.targetEntity != null && GeneralMethods.isRegionProtectedFromBuild(this, this.targetEntity.getLocation())) {
} else if (this.targetEntity != null && (GeneralMethods.isRegionProtectedFromBuild(this, this.targetEntity.getLocation()) || ((targetEntity instanceof Player) && Commands.invincible.contains(((Player) targetEntity).getName())))) {
return;
}

View file

@ -217,7 +217,7 @@ public class FireBlastCharged extends FireAbility<FireBlastConfig> {
}
boolean exploded = false;
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, 2 * this.collisionRadius)) {
for (final Entity entity : GeneralMethods.getEntitiesAroundPoint(this.location, this.collisionRadius)) {
if (entity.getEntityId() == this.player.getEntityId() || GeneralMethods.isRegionProtectedFromBuild(this, entity.getLocation())) {
continue;
}
@ -311,8 +311,10 @@ public class FireBlastCharged extends FireAbility<FireBlastConfig> {
@Override
public void remove() {
super.remove();
if (this.charged) {
this.bPlayer.addCooldown(this);
}
}
@Override
public String getName() {

View file

@ -76,8 +76,6 @@ public class FireJet extends FireAbility<FireJetConfig> {
this.start();
this.previousGlidingState = player.isGliding();
this.bPlayer.addCooldown(this);
}
}
@ -122,6 +120,7 @@ public class FireJet extends FireAbility<FireJetConfig> {
}
this.flightHandler.removeInstance(this.player, this.getName());
this.player.setFallDistance(0);
this.bPlayer.addCooldown(this);
}
@Override

View file

@ -103,7 +103,6 @@ public class WallOfFire extends FireAbility<WallOfFireConfig> {
this.initializeBlocks();
this.start();
this.bPlayer.addCooldown(this);
}
private void affect(final Entity entity) {
@ -211,6 +210,12 @@ public class WallOfFire extends FireAbility<WallOfFireConfig> {
}
}
@Override
public void remove() {
super.remove();
this.bPlayer.addCooldown(this);
}
@Override
public String getName() {
return "WallOfFire";

View file

@ -81,7 +81,6 @@ public class JetBlast extends FireAbility<JetBlastConfig> implements ComboAbilit
return;
}
this.bPlayer.addCooldown("JetBlast", this.cooldown);
this.firstTime = false;
final float spread = 0F;
ParticleEffect.EXPLOSION_LARGE.display(this.player.getLocation(), 1, spread, spread, spread, 0);
@ -108,6 +107,7 @@ public class JetBlast extends FireAbility<JetBlastConfig> implements ComboAbilit
task.remove();
}
super.remove();
this.bPlayer.addCooldown("JetBlast", this.cooldown);
}
@Override

View file

@ -90,7 +90,6 @@ public class JetBlaze extends FireAbility<JetBlazeConfig> implements ComboAbilit
this.remove();
return;
}
this.bPlayer.addCooldown("JetBlaze", this.cooldown);
this.firstTime = false;
} else if (System.currentTimeMillis() - this.time > this.duration) {
this.remove();
@ -105,7 +104,7 @@ public class JetBlaze extends FireAbility<JetBlazeConfig> implements ComboAbilit
fs.setDensity(8);
fs.setSpread(1.0F);
fs.setUseNewParticles(true);
fs.setCollisionRadius(3);
fs.setCollisionRadius(2);
fs.setParticleEffect(ParticleEffect.SMOKE_LARGE);
fs.setDamage(this.damage);
fs.setFireTicks(this.fireTicks);
@ -123,6 +122,7 @@ public class JetBlaze extends FireAbility<JetBlazeConfig> implements ComboAbilit
task.remove();
}
super.remove();
this.bPlayer.addCooldown("JetBlaze", this.cooldown);
}
@Override

View file

@ -3,6 +3,8 @@ package com.projectkorra.projectkorra.firebending.lightning;
import java.util.ArrayList;
import java.util.List;
import com.projectkorra.projectkorra.ability.CoreAbility;
import com.projectkorra.projectkorra.firebending.FireJet;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Entity;
@ -181,6 +183,9 @@ public class Lightning extends LightningAbility<LightningConfig> {
} else if (!this.bPlayer.canBendIgnoreCooldowns(this)) {
this.remove();
return;
} else if (CoreAbility.hasAbility(player, FireJet.class)){
this.removeWithTasks();
return;
}
this.locations.clear();

View file

@ -256,12 +256,11 @@ public class SurgeWall extends WaterAbility<SurgeConfig> {
}
final ArrayList<Block> blocks = new ArrayList<Block>();
final Location targetLoc = GeneralMethods.getTargetedLocation(this.player, (int) this.range, Material.WATER, Material.ICE);
final Location targetLoc = GeneralMethods.getTargetedLocation(this.player, (int) this.range, false, false, Material.WATER, Material.ICE);
this.location = targetLoc.clone();
final Vector eyeDir = this.player.getEyeLocation().getDirection();
Vector vector;
Block block;
for (double i = 0; i <= this.getNightFactor(this.radius); i += 0.5) {
for (double angle = 0; angle < 360; angle += 10) {
vector = GeneralMethods.getOrthogonalVector(eyeDir.clone(), angle, i);

View file

@ -116,8 +116,8 @@ public class WaterReturn extends WaterAbility<EmptyAbilityConfig> {
private void fillBottle() {
final PlayerInventory inventory = this.player.getInventory();
if (inventory.contains(Material.GLASS_BOTTLE)) {
final int index = inventory.first(Material.GLASS_BOTTLE);
if (index >= 0) {
final ItemStack item = inventory.getItem(index);
final ItemStack water = waterBottleItem();
@ -148,27 +148,15 @@ public class WaterReturn extends WaterAbility<EmptyAbilityConfig> {
return false;
}
public static boolean hasWaterBottle(final Player player) {
if (hasAbility(player, WaterReturn.class) || isBending(player)) {
return false;
}
final PlayerInventory inventory = player.getInventory();
if (inventory.contains(Material.POTION)) {
final ItemStack item = inventory.getItem(inventory.first(Material.POTION));
final PotionMeta meta = (PotionMeta) item.getItemMeta();
return meta.getBasePotionData().getType() == PotionType.WATER;
}
return false;
}
public static void emptyWaterBottle(final Player player) {
final PlayerInventory inventory = player.getInventory();
public static int firstWaterBottle(final PlayerInventory inventory) {
int index = inventory.first(Material.POTION);
// Check that the first one found is actually a WATER bottle. We aren't implementing potion bending just yet.
if (index != -1 && !((PotionMeta) inventory.getItem(index).getItemMeta()).getBasePotionData().getType().equals(PotionType.WATER)) {
for (int i = 0; i < inventory.getSize(); i++) {
if (inventory.getItem(i).getType() == Material.POTION) {
if (index != -1) {
int aux = index;
index = -1;
for (int i = aux; i < inventory.getSize(); i++) {
if (inventory.getItem(i) != null && inventory.getItem(i).getType() == Material.POTION && inventory.getItem(i).hasItemMeta()) {
final PotionMeta meta = (PotionMeta) inventory.getItem(i).getItemMeta();
if (meta.getBasePotionData().getType().equals(PotionType.WATER)) {
index = i;
@ -178,6 +166,22 @@ public class WaterReturn extends WaterAbility<EmptyAbilityConfig> {
}
}
return index;
}
public static boolean hasWaterBottle(final Player player) {
if (hasAbility(player, WaterReturn.class) || isBending(player)) {
return false;
}
final PlayerInventory inventory = player.getInventory();
return WaterReturn.firstWaterBottle(inventory) >= 0;
}
public static void emptyWaterBottle(final Player player) {
final PlayerInventory inventory = player.getInventory();
int index = WaterReturn.firstWaterBottle(inventory);
if (index != -1) {
final ItemStack item = inventory.getItem(index);
if (item.getAmount() == 1) {