mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2024-11-29 22:23:59 +01:00
Null check registry on disable
This commit is contained in:
parent
908e678135
commit
d00678b208
@ -139,11 +139,13 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void despawnNPCs(boolean save) {
|
private void despawnNPCs(boolean save) {
|
||||||
for (NPCRegistry reg : Iterables.concat(Arrays.asList(npcRegistry), citizensBackedRegistries)) {
|
for (NPCRegistry registry : Iterables.concat(Arrays.asList(npcRegistry), citizensBackedRegistries)) {
|
||||||
|
if (registry == null)
|
||||||
|
continue;
|
||||||
if (save) {
|
if (save) {
|
||||||
reg.saveToStore();
|
registry.saveToStore();
|
||||||
}
|
}
|
||||||
reg.despawnNPCs(DespawnReason.RELOAD);
|
registry.despawnNPCs(DespawnReason.RELOAD);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user