mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2025-02-11 11:40:40 +00:00
AirBlast fixed a crash causing bug when a user shoots straight down
This commit is contained in:
parent
d6baea87b9
commit
bede932459
1 changed files with 16 additions and 4 deletions
|
@ -1,8 +1,10 @@
|
||||||
package com.projectkorra.ProjectKorra.airbending;
|
package com.projectkorra.ProjectKorra.airbending;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
|
@ -191,7 +193,14 @@ public class AirBlast {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (location.distance(origin) > range) {
|
/*
|
||||||
|
* If a player presses shift and AirBlasts straight down then
|
||||||
|
* the AirBlast's location gets messed up and reading the distance
|
||||||
|
* returns Double.NaN. If we don't remove this instance then
|
||||||
|
* the AirBlast will never be removed.
|
||||||
|
*/
|
||||||
|
double dist = location.distance(origin);
|
||||||
|
if (Double.isNaN(dist) || dist > range) {
|
||||||
instances.remove(id);
|
instances.remove(id);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -255,6 +264,9 @@ public class AirBlast {
|
||||||
if (Commands.invincible.contains(((Player) entity).getName())) return;
|
if (Commands.invincible.contains(((Player) entity).getName())) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(Double.isNaN(velocity.length()))
|
||||||
|
return;
|
||||||
|
|
||||||
Methods.setVelocity(entity, velocity);
|
Methods.setVelocity(entity, velocity);
|
||||||
entity.setFallDistance(0);
|
entity.setFallDistance(0);
|
||||||
if (!isUser && entity instanceof Player) {
|
if (!isUser && entity instanceof Player) {
|
||||||
|
|
Loading…
Reference in a new issue