mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-25 02:27:41 +01:00
Don't teleport if despawned
This commit is contained in:
parent
0036c9d6a2
commit
57373a68a3
@ -326,6 +326,8 @@ public class CitizensNPC extends AbstractNPC {
|
|||||||
@Override
|
@Override
|
||||||
public void teleport(Location location, TeleportCause reason) {
|
public void teleport(Location location, TeleportCause reason) {
|
||||||
super.teleport(location, reason);
|
super.teleport(location, reason);
|
||||||
|
if (!isSpawned())
|
||||||
|
return;
|
||||||
Location npcLoc = getEntity().getLocation(CACHE_LOCATION);
|
Location npcLoc = getEntity().getLocation(CACHE_LOCATION);
|
||||||
if (isSpawned() && npcLoc.getWorld() == location.getWorld() && npcLoc.distanceSquared(location) < 1) {
|
if (isSpawned() && npcLoc.getWorld() == location.getWorld() && npcLoc.distanceSquared(location) < 1) {
|
||||||
NMS.setHeadYaw(getEntity(), location.getYaw());
|
NMS.setHeadYaw(getEntity(), location.getYaw());
|
||||||
|
Loading…
Reference in New Issue
Block a user