mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-12-24 01:58:16 +01:00
Merge pull request #996 from mcmonkey4eva/master
Correct despawn/removal order, clean the codebase a lotta bit
This commit is contained in:
commit
1ed5bf69c0
@ -65,11 +65,11 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
||||
|
||||
@Override
|
||||
public void deregister(NPC npc) {
|
||||
npc.despawn(DespawnReason.REMOVAL);
|
||||
npcs.remove(npc);
|
||||
if (saves != null) {
|
||||
saves.clearData(npc);
|
||||
}
|
||||
npc.despawn(DespawnReason.REMOVAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -77,11 +77,11 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
||||
Iterator<NPC> itr = iterator();
|
||||
while (itr.hasNext()) {
|
||||
NPC npc = itr.next();
|
||||
itr.remove();
|
||||
npc.despawn(DespawnReason.REMOVAL);
|
||||
for (Trait t : npc.getTraits()) {
|
||||
t.onRemove();
|
||||
}
|
||||
itr.remove();
|
||||
if (saves != null) {
|
||||
saves.clearData(npc);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user