mirror of
https://github.com/CitizensDev/Citizens2.git
synced 2025-01-28 11:01:39 +01:00
Validate state
This commit is contained in:
parent
71b8744060
commit
5447561d3d
@ -381,9 +381,14 @@ public class Citizens extends JavaPlugin implements CitizensPlugin {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setDefaultNPCDataStore(NPCDataStore store) {
|
public void setDefaultNPCDataStore(NPCDataStore store) {
|
||||||
|
if (store == null) {
|
||||||
|
throw new IllegalArgumentException("must be non-null");
|
||||||
|
}
|
||||||
|
if (saves != null) {
|
||||||
saves.storeAll(npcRegistry);
|
saves.storeAll(npcRegistry);
|
||||||
saves.saveToDiskImmediate();
|
saves.saveToDiskImmediate();
|
||||||
despawnNPCs();
|
despawnNPCs();
|
||||||
|
}
|
||||||
this.saves = store;
|
this.saves = store;
|
||||||
this.npcRegistry = new CitizensNPCRegistry(saves);
|
this.npcRegistry = new CitizensNPCRegistry(saves);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user