From 107fc9d5f694f734df37d2b9d7497f98ac2b26de Mon Sep 17 00:00:00 2001 From: Nate Mortensen Date: Tue, 22 Nov 2016 19:25:15 -0700 Subject: [PATCH] Fix Blink ability with Spectators When using blink, players are teleported away from other players within a one block radius of them. However, if a player happens to have the exact same position(only can occur when a player is spectating them), division by 0 occurs, resulting in the player being teleported to NaN, as any operation with NaN is also NaN. To fix this, Blink now ignores players in Spectator mode. This change could also address the hypothetical scenario where a spectator is within the one block radius and results in a blinking player getting teleported in a weird direction. --- .../minecraft/game/classcombat/Skill/Assassin/Blink.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java index 2da9df000..bd50cddd3 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Blink.java @@ -4,6 +4,7 @@ import java.util.HashMap; import org.bukkit.Bukkit; import org.bukkit.Effect; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; @@ -112,7 +113,7 @@ public class Blink extends SkillActive //Lock Players for (Player cur : player.getWorld().getPlayers()) { - if (cur.equals(player)) + if (cur.equals(player) || cur.getGameMode() == GameMode.SPECTATOR) continue; if (UtilMath.offset(newTarget, cur.getLocation()) > 1)