mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-26 18:11:49 +01:00
Remove extra NPCDespawnEvent
This commit is contained in:
parent
74839e9843
commit
c7789e5073
@ -82,6 +82,7 @@ import net.citizensnpcs.api.event.NPCDamageEvent;
|
||||
import net.citizensnpcs.api.event.NPCDeathEvent;
|
||||
import net.citizensnpcs.api.event.NPCDespawnEvent;
|
||||
import net.citizensnpcs.api.event.NPCLeftClickEvent;
|
||||
import net.citizensnpcs.api.event.NPCRemoveEvent;
|
||||
import net.citizensnpcs.api.event.NPCRightClickEvent;
|
||||
import net.citizensnpcs.api.event.NPCSpawnEvent;
|
||||
import net.citizensnpcs.api.event.NPCVehicleDamageEvent;
|
||||
@ -452,6 +453,11 @@ public class EventListen implements Listener {
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onNPCRemove(NPCRemoveEvent event) {
|
||||
toRespawn.values().remove(event.getNPC());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||
public void onNPCSpawn(NPCSpawnEvent event) {
|
||||
skinUpdateTracker.onNPCSpawn(event.getNPC());
|
||||
|
@ -67,9 +67,6 @@ public class CitizensNPC extends AbstractNPC {
|
||||
public boolean despawn(DespawnReason reason) {
|
||||
if (!isSpawned() && reason != DespawnReason.DEATH) {
|
||||
Messaging.debug("Tried to despawn", getId(), "while already despawned, DespawnReason." + reason);
|
||||
if (reason == DespawnReason.REMOVAL) {
|
||||
Bukkit.getPluginManager().callEvent(new NPCDespawnEvent(this, reason));
|
||||
}
|
||||
if (reason == DespawnReason.RELOAD) {
|
||||
unloadEvents();
|
||||
}
|
||||
@ -403,14 +400,6 @@ public class CitizensNPC extends AbstractNPC {
|
||||
}
|
||||
}
|
||||
|
||||
private void updateCustomNameVisibility() {
|
||||
String nameplateVisible = data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString();
|
||||
if (requiresNameHologram()) {
|
||||
nameplateVisible = "false";
|
||||
}
|
||||
getEntity().setCustomNameVisible(Boolean.parseBoolean(nameplateVisible));
|
||||
}
|
||||
|
||||
private void updateCustomName() {
|
||||
boolean nameVisibility = false;
|
||||
if (!getEntity().isCustomNameVisible()
|
||||
@ -436,6 +425,14 @@ public class CitizensNPC extends AbstractNPC {
|
||||
getOrAddTrait(ScoreboardTrait.class).apply(team, nameVisibility);
|
||||
}
|
||||
|
||||
private void updateCustomNameVisibility() {
|
||||
String nameplateVisible = data().<Object> get(NPC.NAMEPLATE_VISIBLE_METADATA, true).toString();
|
||||
if (requiresNameHologram()) {
|
||||
nameplateVisible = "false";
|
||||
}
|
||||
getEntity().setCustomNameVisible(Boolean.parseBoolean(nameplateVisible));
|
||||
}
|
||||
|
||||
private void updateFlyableState() {
|
||||
EntityType type = isSpawned() ? getEntity().getType() : getOrAddTrait(MobType.class).getType();
|
||||
if (type == null)
|
||||
|
Loading…
Reference in New Issue
Block a user