Preserve pitch and yaw in NpcManager teleportations
This commit is contained in:
parent
930cdf6c07
commit
248438535b
@ -13,6 +13,7 @@ import java.util.UUID;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
@ -345,6 +346,7 @@ public class NpcManager extends MiniPlugin
|
|||||||
{
|
{
|
||||||
UtilEnt.Vegetate(entity);
|
UtilEnt.Vegetate(entity);
|
||||||
UtilEnt.silence(entity, true);
|
UtilEnt.silence(entity, true);
|
||||||
|
UtilEnt.ghost(entity, true, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (npc.getDatabaseRecord().getHelmet() != null)
|
if (npc.getDatabaseRecord().getHelmet() != null)
|
||||||
@ -421,7 +423,10 @@ public class NpcManager extends MiniPlugin
|
|||||||
|
|
||||||
if (npc.getFailedAttempts() >= 10 || npc.getDatabaseRecord().getRadius() == 0)
|
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));
|
entity.setVelocity(new Vector(0, 0, 0));
|
||||||
npc.setFailedAttempts(0);
|
npc.setFailedAttempts(0);
|
||||||
}
|
}
|
||||||
@ -457,7 +462,10 @@ public class NpcManager extends MiniPlugin
|
|||||||
|
|
||||||
if (!entity.isDead() && entity.isValid())
|
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));
|
entity.setVelocity(new Vector(0, 0, 0));
|
||||||
|
|
||||||
npc.setFailedAttempts(0);
|
npc.setFailedAttempts(0);
|
||||||
@ -557,7 +565,10 @@ public class NpcManager extends MiniPlugin
|
|||||||
UtilEnt.ghost(entity, true, false);
|
UtilEnt.ghost(entity, true, false);
|
||||||
|
|
||||||
if (npc.getDatabaseRecord().getRadius() == 0)
|
if (npc.getDatabaseRecord().getRadius() == 0)
|
||||||
|
{
|
||||||
UtilEnt.Vegetate(entity);
|
UtilEnt.Vegetate(entity);
|
||||||
|
UtilEnt.ghost(entity, true, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isDetachedNpc((LivingEntity) entity))
|
if (isDetachedNpc((LivingEntity) entity))
|
||||||
|
Loading…
Reference in New Issue
Block a user