Merge pull request #310 from jedk1/master

Fix multiple bugs
This commit is contained in:
OmniCypher 2015-11-25 13:29:09 -08:00
commit 9fac9957f3
7 changed files with 36 additions and 6 deletions

View file

@ -5,6 +5,7 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
@ -157,6 +158,7 @@ public class PKListener implements Listener {
ProjectKorra plugin;
public static HashMap<Player, String> bendingDeathPlayer = new HashMap<Player, String>(); // Player killed by Bending
public static List<UUID> interact = new ArrayList<UUID>(); // Player right click block
public PKListener(ProjectKorra plugin) {
this.plugin = plugin;
@ -652,8 +654,12 @@ public class PKListener implements Listener {
StringBuilder sb = new StringBuilder();
if (event.getSubElement() != null) {
sb.append(event.getSubElement().getChatColor());
} else if (event.getElement() != null) {
} else {
if (event.getElement() != null) {
sb.append(event.getElement().getChatColor());
} else {
sb.append(GeneralMethods.getAvatarColor());
}
}
sb.append(event.getAbility());
bendingDeathPlayer.put(event.getVictim(), sb.toString());
@ -963,6 +969,15 @@ public class PKListener implements Listener {
Player player = event.getPlayer();
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
final UUID uuid = player.getUniqueId();
interact.add(uuid);
new BukkitRunnable() {
public void run() {
interact.remove(uuid);
}
}.runTaskLater(plugin, 5);
String ability = GeneralMethods.getBoundAbility(player);
ComboManager.addComboAbility(player, ClickType.RIGHT_CLICK);
if (ability != null && ability.equalsIgnoreCase("EarthSmash"))
@ -1287,6 +1302,9 @@ public class PKListener implements Listener {
return;
Player player = event.getPlayer();
if (interact.contains(player.getUniqueId())) return;
ComboManager.addComboAbility(player, ClickType.LEFT_CLICK);
if (Suffocate.isBreathbent(player)) {

View file

@ -130,6 +130,9 @@ public class AirBlast implements ConfigLoadable {
if (!origins.containsKey(player))
return;
Location origin = origins.get(player);
if (player.isDead() || !player.isOnline())
return;
if (!origin.getWorld().equals(player.getWorld())) {
origins.remove(player);
return;

View file

@ -230,6 +230,11 @@ public class AirCombo implements ConfigLoadable {
if (!EarthMethods.isTransparentToEarthbending(player, currentLoc.getBlock()))
currentLoc.subtract(direction.clone().multiply(speed));
if (player.getWorld() != currentLoc.getWorld()) {
remove();
return;
}
if (Math.abs(player.getLocation().distance(currentLoc)) > range) {
remove();
return;

View file

@ -94,10 +94,9 @@ public class AirSpout implements ConfigLoadable {
}
public boolean progress() {
if (!GeneralMethods.canBend(player.getName(), "AirSpout")
if (player.isDead() || !player.isOnline() || !GeneralMethods.canBend(player.getName(), "AirSpout")
// || !Methods.hasAbility(player, Abilities.AirSpout)
|| player.getEyeLocation().getBlock().isLiquid() || GeneralMethods.isSolid(player.getEyeLocation().getBlock())
|| player.isDead() || !player.isOnline()) {
|| player.getEyeLocation().getBlock().isLiquid() || GeneralMethods.isSolid(player.getEyeLocation().getBlock())) {
remove();
return false;
}

View file

@ -103,6 +103,9 @@ public class AirSuction implements ConfigLoadable {
if (!origins.containsKey(player))
return;
Location origin = origins.get(player);
if (player.isDead() || !player.isOnline())
return;
if (!origin.getWorld().equals(player.getWorld())) {
origins.remove(player);
return;

View file

@ -76,6 +76,9 @@ public class HorizontalVelocityChangeEvent extends Event implements Cancellable
}
public double getDistanceTraveled() {
if (start.getWorld() != end.getWorld()) {
return 0;
}
return start.distance(end);
}

View file

@ -34,7 +34,6 @@ public class Flight {
if (instances.containsKey(player)) {
Flight flight = instances.get(player);
flight.refresh(source);
instances.replace(player, flight);
return;
}
this.couldFly = player.getAllowFlight();