Preserve pitch and yaw in NpcManager teleportations

This commit is contained in:
CoderTim 2014-10-16 22:31:09 -04:00
parent 930cdf6c07
commit 248438535b
1 changed files with 13 additions and 2 deletions

View File

@ -13,6 +13,7 @@ import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.configuration.InvalidConfigurationException;
@ -345,6 +346,7 @@ public class NpcManager extends MiniPlugin
{
UtilEnt.Vegetate(entity);
UtilEnt.silence(entity, true);
UtilEnt.ghost(entity, true, false);
}
if (npc.getDatabaseRecord().getHelmet() != null)
@ -421,7 +423,10 @@ public class NpcManager extends MiniPlugin
if (npc.getFailedAttempts() >= 10 || npc.getDatabaseRecord().getRadius() == 0)
{
entity.teleport(npc.getLocation());
Location location = npc.getLocation();
location.setPitch(entity.getLocation().getPitch());
location.setYaw(entity.getLocation().getYaw());
entity.teleport(location);
entity.setVelocity(new Vector(0, 0, 0));
npc.setFailedAttempts(0);
}
@ -457,7 +462,10 @@ public class NpcManager extends MiniPlugin
if (!entity.isDead() && entity.isValid())
{
entity.teleport(npc.getLocation());
Location location = npc.getLocation();
location.setPitch(entity.getLocation().getPitch());
location.setYaw(entity.getLocation().getYaw());
entity.teleport(location);
entity.setVelocity(new Vector(0, 0, 0));
npc.setFailedAttempts(0);
@ -557,7 +565,10 @@ public class NpcManager extends MiniPlugin
UtilEnt.ghost(entity, true, false);
if (npc.getDatabaseRecord().getRadius() == 0)
{
UtilEnt.Vegetate(entity);
UtilEnt.ghost(entity, true, false);
}
}
if (isDetachedNpc((LivingEntity) entity))