mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-27 18:41:23 +01:00
Remove entity if world failed to add
This commit is contained in:
parent
d98833ca66
commit
aaf870372c
@ -299,10 +299,12 @@ public class CitizensNPC extends AbstractNPC {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (timer++ > 10) {
|
if (timer++ > 10) {
|
||||||
cancel();
|
|
||||||
Messaging.debug("Couldn't spawn", CitizensNPC.this, "entity not added to world");
|
Messaging.debug("Couldn't spawn", CitizensNPC.this, "entity not added to world");
|
||||||
|
entityController.remove();
|
||||||
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getEntity() == null || !getEntity().isValid())
|
if (getEntity() == null || !getEntity().isValid())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -314,9 +316,9 @@ public class CitizensNPC extends AbstractNPC {
|
|||||||
Bukkit.getPluginManager().callEvent(spawnEvent);
|
Bukkit.getPluginManager().callEvent(spawnEvent);
|
||||||
|
|
||||||
if (spawnEvent.isCancelled()) {
|
if (spawnEvent.isCancelled()) {
|
||||||
entityController.remove();
|
|
||||||
Messaging.debug("Couldn't spawn", CitizensNPC.this, "SpawnReason." + reason,
|
Messaging.debug("Couldn't spawn", CitizensNPC.this, "SpawnReason." + reason,
|
||||||
"due to event cancellation.");
|
"due to event cancellation.");
|
||||||
|
entityController.remove();
|
||||||
cancel();
|
cancel();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user