diff --git a/src/com/projectkorra/projectkorra/airbending/AirFlight.java b/src/com/projectkorra/projectkorra/airbending/AirFlight.java index 307fdbab..ca4e23d0 100644 --- a/src/com/projectkorra/projectkorra/airbending/AirFlight.java +++ b/src/com/projectkorra/projectkorra/airbending/AirFlight.java @@ -1,8 +1,7 @@ package com.projectkorra.projectkorra.airbending; -import com.projectkorra.projectkorra.ability.FlightAbility; -import com.projectkorra.projectkorra.object.PlayerFlyData; -import com.projectkorra.projectkorra.util.Flight; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import org.bukkit.GameMode; import org.bukkit.Location; @@ -10,24 +9,28 @@ import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.util.Vector; -import java.util.concurrent.ConcurrentHashMap; +import com.projectkorra.projectkorra.ability.FlightAbility; +import com.projectkorra.projectkorra.ability.CoreAbility; +import com.projectkorra.projectkorra.object.PlayerFlyData; +import com.projectkorra.projectkorra.util.Flight; public class AirFlight extends FlightAbility { - private static final ConcurrentHashMap HITS = new ConcurrentHashMap<>(); - private static final ConcurrentHashMap HOVERING = new ConcurrentHashMap<>(); + private static final Map HITS = new ConcurrentHashMap<>(); + private static final Map HOVERING = new ConcurrentHashMap<>(); private boolean firstProgressIteration; private int maxHitsBeforeRemoval; private double speed; private Flight flight; - static int hoverY; + private double hoverY; public AirFlight(Player player) { super(player); this.maxHitsBeforeRemoval = getConfig().getInt("Abilities.Air.Flight.MaxHits"); this.speed = getConfig().getDouble("Abilities.Air.Flight.Speed"); this.firstProgressIteration = true; + hoverY = player.getLocation().getBlockY(); start(); } @@ -65,6 +68,9 @@ public class AirFlight extends FlightAbility { } public static void setHovering(Player player, boolean bool) { + AirFlight flight = CoreAbility.getAbility(player, AirFlight.class); + flight.hoverY = player.getLocation().getBlockY(); + String playername = player.getName(); if (bool) { @@ -72,7 +78,6 @@ public class AirFlight extends FlightAbility { HOVERING.put(playername, new PlayerFlyData(player.getAllowFlight(), player.isFlying())); player.setVelocity(new Vector(0, 0, 0)); player.setFlying(true); - hoverY = Integer.valueOf((int) player.getLocation().getY()); } } else { if (HOVERING.containsKey(playername)) { @@ -109,10 +114,10 @@ public class AirFlight extends FlightAbility { Vector vec = player.getVelocity().clone(); vec.setY(0); player.setVelocity(vec); - if (!Integer.valueOf((int) player.getLocation().getY()).equals(hoverY)) { + if (player.getLocation().getBlockY() != hoverY) { Location loc = new Location(player.getWorld(), player.getLocation().getX(), - hoverY + 0.5, + hoverY + 0.5, player.getLocation().getZ(), player.getLocation().getYaw(), player.getLocation().getPitch()); @@ -161,4 +166,4 @@ public class AirFlight extends FlightAbility { return true; } -} +} \ No newline at end of file diff --git a/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java b/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java index 0fbff854..28f745fc 100644 --- a/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java +++ b/src/com/projectkorra/projectkorra/chiblocking/SwiftKick.java @@ -35,6 +35,7 @@ public class SwiftKick extends ChiAbility { return; } if (player.getLocation().subtract(0, 0.5, 0).getBlock().getType() != Material.AIR) { + remove(); return; } DamageHandler.damageEntity(target, damage, this);