mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-27 05:05:20 +01:00
Only store lastUUID, not full NPC instance
This commit is contained in:
parent
8afaf23c1d
commit
8a87326c44
@ -172,7 +172,7 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
|||||||
public Iterator<NPC> iterator() {
|
public Iterator<NPC> iterator() {
|
||||||
return new Iterator<NPC>() {
|
return new Iterator<NPC>() {
|
||||||
Iterator<NPC> itr = npcs.valueCollection().iterator();
|
Iterator<NPC> itr = npcs.valueCollection().iterator();
|
||||||
NPC npc;
|
UUID lastUUID;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
@ -181,16 +181,19 @@ public class CitizensNPCRegistry implements NPCRegistry {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NPC next() {
|
public NPC next() {
|
||||||
npc = itr.next();
|
NPC npc = itr.next();
|
||||||
|
if (npc != null && npc.getUniqueId() != null) {
|
||||||
|
lastUUID = npc.getUniqueId();
|
||||||
|
}
|
||||||
return npc;
|
return npc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
itr.remove();
|
itr.remove();
|
||||||
if (npc != null) {
|
if (lastUUID != null) {
|
||||||
uniqueNPCs.remove(npc.getUniqueId());
|
uniqueNPCs.remove(lastUUID);
|
||||||
npc = null;
|
lastUUID = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user