mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-26 20:55:44 +01:00
Fix despawn events not being called when NPC is killed while vulnerable
This commit is contained in:
parent
e56cbb5e17
commit
b36e62effd
@ -59,7 +59,7 @@ public class CitizensNPC extends AbstractNPC {
|
||||
|
||||
@Override
|
||||
public boolean despawn(DespawnReason reason) {
|
||||
if (!isSpawned()) {
|
||||
if (!isSpawned() && reason != DespawnReason.DEATH) {
|
||||
Messaging.debug("Tried to despawn", getId(), "while already despawned.");
|
||||
if (reason == DespawnReason.REMOVAL) {
|
||||
Bukkit.getPluginManager().callEvent(new NPCDespawnEvent(this, reason));
|
||||
|
@ -3,6 +3,15 @@ package net.citizensnpcs.npc.ai;
|
||||
import java.util.Iterator;
|
||||
import java.util.ListIterator;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.citizensnpcs.Settings.Setting;
|
||||
import net.citizensnpcs.api.ai.EntityTarget;
|
||||
import net.citizensnpcs.api.ai.Navigator;
|
||||
@ -26,15 +35,6 @@ import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.util.DataKey;
|
||||
import net.citizensnpcs.util.NMS;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class CitizensNavigator implements Navigator, Runnable {
|
||||
private final NavigatorParameters defaultParams = new NavigatorParameters().baseSpeed(UNINITIALISED_SPEED)
|
||||
.range(Setting.DEFAULT_PATHFINDING_RANGE.asFloat())
|
||||
|
Loading…
Reference in New Issue
Block a user