Skip to content

Commit

Permalink
Pass teleport cause through
Browse files Browse the repository at this point in the history
  • Loading branch information
fullwall committed Feb 14, 2023
1 parent 723928f commit bff1964
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/main/java/net/citizensnpcs/api/npc/AbstractNPC.java
Expand Up @@ -513,22 +513,22 @@ public void setUseMinecraftAI(boolean use) {
data().setPersistent(NPC.Metadata.USE_MINECRAFT_AI, use);
}

private void teleport(final Entity entity, Location location, int delay) {
private void teleport(final Entity entity, Location location, int delay, TeleportCause cause) {
final Entity passenger = entity.getPassenger();
entity.eject();
if (!location.getWorld().equals(entity.getWorld())) {
Bukkit.getScheduler().scheduleSyncDelayedTask(CitizensAPI.getPlugin(), new Runnable() {
@Override
public void run() {
entity.teleport(location);
entity.teleport(location, cause);
}
}, delay++);
} else {
entity.teleport(location);
entity.teleport(location, cause);
}
if (passenger == null)
return;
teleport(passenger, location, delay++);
teleport(passenger, location, delay++, cause);
Runnable task = new Runnable() {
@Override
public void run() {
Expand All @@ -555,7 +555,7 @@ public void teleport(Location location, TeleportCause cause) {
entity = entity.getVehicle();
}
location.getBlock().getChunk();
teleport(entity, location, 5);
teleport(entity, location, 5, cause);
}

protected void unloadEvents() {
Expand Down

0 comments on commit bff1964

Please sign in to comment.