mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Make MountTrait more reliable by making the NPC leave its vehicle on despawn
This commit is contained in:
parent
9329c66667
commit
2442e24255
@ -340,8 +340,9 @@ public class CitizensNavigator implements Navigator, Runnable {
|
||||
if (!isNavigating())
|
||||
return;
|
||||
Entity vehicle = NMS.getVehicle(npc.getEntity());
|
||||
if (!(vehicle instanceof NPCHolder))
|
||||
if (!(vehicle instanceof NPCHolder)) {
|
||||
return;
|
||||
}
|
||||
NPC mount = ((NPCHolder) vehicle).getNPC();
|
||||
switch (getTargetType()) {
|
||||
case ENTITY:
|
||||
|
@ -30,6 +30,14 @@ public class MountTrait extends Trait {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDespawn() {
|
||||
Entity e = NMS.getVehicle(npc.getEntity());
|
||||
if (e != null) {
|
||||
npc.getEntity().leaveVehicle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpawn() {
|
||||
checkMount(null);
|
||||
|
Loading…
Reference in New Issue
Block a user