From f46285b238a9b9cf0ce8c69e9f61295901509275 Mon Sep 17 00:00:00 2001 From: fullwall Date: Tue, 2 Mar 2021 20:52:41 +0800 Subject: [PATCH] Disable flock caching --- .../main/java/net/citizensnpcs/trait/FollowTrait.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/net/citizensnpcs/trait/FollowTrait.java b/main/src/main/java/net/citizensnpcs/trait/FollowTrait.java index fa38f7e87a..1829427ab2 100644 --- a/main/src/main/java/net/citizensnpcs/trait/FollowTrait.java +++ b/main/src/main/java/net/citizensnpcs/trait/FollowTrait.java @@ -53,8 +53,8 @@ public boolean isEnabled() { } @Override - public void onAttach() { - flock = new Flocker(npc, new RadiusNPCFlock(4, 20), new SeparationBehavior(1)); + public void onDespawn() { + flock = null; } @EventHandler @@ -71,6 +71,11 @@ private void onEntityDamage(EntityDamageByEntityEvent event) { } } + @Override + public void onSpawn() { + flock = new Flocker(npc, new RadiusNPCFlock(4, 0), new SeparationBehavior(1)); + } + @Override public void run() { if (player == null || !player.isValid()) {