mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-10 21:02:36 +01:00
call event elsewhere
This commit is contained in:
parent
32abcf8a79
commit
456c9bfceb
@ -4,6 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.citizensnpcs.api.Citizens;
|
||||
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
||||
import net.citizensnpcs.api.event.NPCSpawnEvent;
|
||||
import net.citizensnpcs.api.npc.trait.Character;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
@ -113,6 +114,8 @@ public class CitizensNPC implements NPC {
|
||||
|
||||
@Override
|
||||
public void despawn() {
|
||||
Bukkit.getPluginManager().callEvent(new NPCDespawnEvent(this));
|
||||
|
||||
mcEntity.die();
|
||||
((CitizensNPCManager) Citizens.getNPCManager()).despawn(this);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@ import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Server;
|
||||
import org.bukkit.World;
|
||||
@ -15,7 +14,6 @@ import org.bukkit.craftbukkit.CraftWorld;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
||||
import net.citizensnpcs.api.Citizens;
|
||||
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
||||
import net.citizensnpcs.api.npc.NPC;
|
||||
import net.citizensnpcs.api.npc.NPCManager;
|
||||
import net.citizensnpcs.api.npc.trait.Character;
|
||||
@ -109,8 +107,6 @@ public class CitizensNPCManager implements NPCManager {
|
||||
}
|
||||
|
||||
public void despawn(NPC npc) {
|
||||
Bukkit.getPluginManager().callEvent(new NPCDespawnEvent(npc));
|
||||
|
||||
CraftNPC mcEntity = ((CitizensNPC) npc).getHandle();
|
||||
getWorldServer(((LocationTrait) npc.getTrait("location")).getLocation().getWorld()).removeEntity(mcEntity);
|
||||
spawned.remove(mcEntity.getPlayer());
|
||||
|
Loading…
Reference in New Issue
Block a user