diff --git a/src/com/projectkorra/projectkorra/PKListener.java b/src/com/projectkorra/projectkorra/PKListener.java index 42f9d3de..e97528b0 100644 --- a/src/com/projectkorra/projectkorra/PKListener.java +++ b/src/com/projectkorra/projectkorra/PKListener.java @@ -560,7 +560,7 @@ public class PKListener implements Listener { @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onEntityTeleportEvent(final EntityTeleportEvent event) { final Entity entity = event.getEntity(); - if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity) || MetalClips.isControlled((LivingEntity) entity)) { + if (MovementHandler.isStopped(entity) || Bloodbending.isBloodbent(entity) || Suffocate.isBreathbent(entity) || (entity instanceof LivingEntity && MetalClips.isControlled((LivingEntity) entity))) { event.setCancelled(true); } @@ -1415,9 +1415,18 @@ public class PKListener implements Listener { } } - @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) - public void onPlayerSwing(final PlayerAnimationEvent event) { + @EventHandler(priority = EventPriority.NORMAL) + public void onPlayerSwing(final PlayerInteractEvent event) { final Player player = event.getPlayer(); + if (event.getHand() != EquipmentSlot.HAND) { + return; + } + if (event.getAction() != Action.LEFT_CLICK_BLOCK && event.getAction() != Action.LEFT_CLICK_AIR) { + return; + } + if (event.getAction() == Action.LEFT_CLICK_BLOCK && event.isCancelled()){ + return; + } final BendingPlayer bPlayer = BendingPlayer.getBendingPlayer(player); if (bPlayer == null) { return; @@ -1663,9 +1672,10 @@ public class PKListener implements Listener { return; } } - - if (CoreAbility.getAbility(player, FireJet.class) != null) { - event.setCancelled(true); + if (ConfigManager.getConfig().getBoolean("Abilities.Fire.FireJet.ShowGliding")) { + if (CoreAbility.getAbility(player, FireJet.class) != null) { + event.setCancelled(true); + } } } diff --git a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java index 4d034320..4c3c3f20 100644 --- a/src/com/projectkorra/projectkorra/configuration/ConfigManager.java +++ b/src/com/projectkorra/projectkorra/configuration/ConfigManager.java @@ -817,7 +817,7 @@ public class ConfigManager { config.addDefault("Abilities.Air.AirBurst.AngleTheta", 10); config.addDefault("Abilities.Air.AirScooter.Enabled", true); - config.addDefault("Abilities.Air.AirScooter.ShowSitting", true); + config.addDefault("Abilities.Air.AirScooter.ShowSitting", false); config.addDefault("Abilities.Air.AirScooter.Speed", 0.675); config.addDefault("Abilities.Air.AirScooter.Interval", 100); config.addDefault("Abilities.Air.AirScooter.Radius", 1); @@ -1363,6 +1363,7 @@ public class ConfigManager { config.addDefault("Abilities.Fire.FireJet.Speed", 0.8); config.addDefault("Abilities.Fire.FireJet.Duration", 2000); config.addDefault("Abilities.Fire.FireJet.Cooldown", 7000); + config.addDefault("Abilities.Fire.FireJet.ShowGliding", false); config.addDefault("Abilities.Fire.FireManipulation.Enabled", false); diff --git a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java index b84c4801..7cce24da 100644 --- a/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java +++ b/src/com/projectkorra/projectkorra/earthbending/EarthGrab.java @@ -292,11 +292,15 @@ public class EarthGrab extends EarthAbility { if (!isEarth(entity.getLocation().clone().subtract(0, 1, 0).getBlock()) && (this.bPlayer.canSandbend() && !isSand(entity.getLocation().clone().subtract(0, 1, 0).getBlock())) && entity.getLocation().clone().subtract(0, 1, 0).getBlock().getType() != Material.FARMLAND) { continue; } - - if (entity instanceof Arrow) { - final Location l = entity.getLocation(); - entity.remove(); - entity = l.getWorld().dropItem(l, new ItemStack(Material.ARROW, 1)); + if (entity instanceof Trident) { + continue; + } else if (entity instanceof Arrow) { + Arrow arrow = (Arrow) entity; + if (arrow.getPickupStatus() == Arrow.PickupStatus.ALLOWED) { + final Location l = entity.getLocation(); + entity.remove(); + entity = l.getWorld().dropItem(l, new ItemStack(Material.ARROW, 1)); + } } else if (!(entity instanceof Item)) { continue; } diff --git a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java index ea7e9d7f..00289329 100644 --- a/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java +++ b/src/com/projectkorra/projectkorra/earthbending/passive/DensityShift.java @@ -1,14 +1,5 @@ package com.projectkorra.projectkorra.earthbending.passive; -import java.util.HashSet; -import java.util.Set; - -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.block.Block; -import org.bukkit.block.BlockFace; -import org.bukkit.entity.Player; - import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ability.EarthAbility; @@ -18,6 +9,14 @@ import com.projectkorra.projectkorra.command.Commands; import com.projectkorra.projectkorra.configuration.ConfigManager; import com.projectkorra.projectkorra.util.TempBlock; import com.projectkorra.projectkorra.util.TempBlock.RevertTask; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; + +import java.util.HashSet; +import java.util.Set; public class DensityShift extends EarthAbility implements PassiveAbility { private static final Set SAND_BLOCKS = new HashSet<>(); @@ -87,8 +86,10 @@ public class DensityShift extends EarthAbility implements PassiveAbility { public static void revertAllSand() { for (final TempBlock block : SAND_BLOCKS) { + block.setRevertTask(null); block.revertBlock(); } + SAND_BLOCKS.clear(); } public static void removeAll() { diff --git a/src/com/projectkorra/projectkorra/firebending/FireJet.java b/src/com/projectkorra/projectkorra/firebending/FireJet.java index 5a538753..6d19de01 100644 --- a/src/com/projectkorra/projectkorra/firebending/FireJet.java +++ b/src/com/projectkorra/projectkorra/firebending/FireJet.java @@ -28,6 +28,7 @@ public class FireJet extends FireAbility { private double speed; private Random random; private Boolean previousGlidingState; + private Boolean showGliding; public FireJet(final Player player) { super(player); @@ -49,6 +50,7 @@ public class FireJet extends FireAbility { this.duration = getConfig().getLong("Abilities.Fire.FireJet.Duration"); this.speed = getConfig().getDouble("Abilities.Fire.FireJet.Speed"); this.cooldown = getConfig().getLong("Abilities.Fire.FireJet.Cooldown"); + this.showGliding = getConfig().getBoolean("Abilities.Fire.FireJet.ShowGliding"); this.random = new Random(); this.speed = this.getDayFactor(this.speed); @@ -80,8 +82,10 @@ public class FireJet extends FireAbility { this.time = System.currentTimeMillis(); this.start(); - previousGlidingState = player.isGliding(); - player.setGliding(true); + if (showGliding) { + previousGlidingState = player.isGliding(); + player.setGliding(true); + } this.bPlayer.addCooldown(this); } } @@ -118,7 +122,9 @@ public class FireJet extends FireAbility { @Override public void remove() { super.remove(); - this.player.setGliding(previousGlidingState); + if (showGliding) { + this.player.setGliding(previousGlidingState); + } flightHandler.removeInstance(this.player, this.getName()); this.player.setFallDistance(0); } diff --git a/src/com/projectkorra/projectkorra/firebending/HeatControl.java b/src/com/projectkorra/projectkorra/firebending/HeatControl.java index 2c76d160..eff789da 100644 --- a/src/com/projectkorra/projectkorra/firebending/HeatControl.java +++ b/src/com/projectkorra/projectkorra/firebending/HeatControl.java @@ -1,26 +1,5 @@ package com.projectkorra.projectkorra.firebending; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Random; -import java.util.Set; - -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.data.Levelled; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; -import org.bukkit.scheduler.BukkitRunnable; -import org.bukkit.util.Vector; - import com.projectkorra.projectkorra.BendingPlayer; import com.projectkorra.projectkorra.GeneralMethods; import com.projectkorra.projectkorra.ProjectKorra; @@ -36,6 +15,18 @@ import com.projectkorra.projectkorra.waterbending.WaterSpoutWave; import com.projectkorra.projectkorra.waterbending.combo.IceWave; import com.projectkorra.projectkorra.waterbending.ice.PhaseChange; import com.projectkorra.projectkorra.waterbending.multiabilities.WaterArmsSpear; +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.data.Levelled; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.scheduler.BukkitRunnable; +import org.bukkit.util.Vector; + +import java.util.*; public class HeatControl extends FireAbility { @@ -43,7 +34,7 @@ public class HeatControl extends FireAbility { COOK, EXTINGUISH, MELT, SOLIDIFY } - private static final Material[] COOKABLE_MATERIALS = { Material.BEEF, Material.CHICKEN, Material.COD, Material.PORKCHOP, Material.POTATO, Material.RABBIT, Material.MUTTON, Material.SALMON }; + private static final Material[] COOKABLE_MATERIALS = { Material.BEEF, Material.CHICKEN, Material.COD, Material.PORKCHOP, Material.POTATO, Material.RABBIT, Material.MUTTON, Material.SALMON, Material.KELP }; private HeatControlType heatControlType; @@ -270,6 +261,9 @@ public class HeatControl extends FireAbility { case SALMON: cooked = new ItemStack(Material.COOKED_SALMON); break; + case KELP: + cooked = new ItemStack(Material.DRIED_KELP); + break; default: break; }