Delay registry check in-case Citizens is slow to enable

This commit is contained in:
PikaMug 2019-04-22 23:42:46 -04:00
parent 1ff72d811d
commit 4f921c1c5f
2 changed files with 10 additions and 3 deletions

View File

@ -78,6 +78,10 @@ public class Dependencies {
return citizens;
}
public void disableCitizens() {
citizens = null;
}
public Denizen getDenizen() {
return denizen;
}
@ -109,9 +113,6 @@ public class Dependencies {
try {
if (isPluginAvailable("Citizens")) {
citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens");
if (citizens.getNPCRegistry() == null) {
citizens = null;
}
}
} catch (Exception e) {
plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled.");

View File

@ -477,6 +477,12 @@ public class Quests extends JavaPlugin implements ConversationAbandonedListener
+ ", " + events.size() + " Event(s)"
+ ", " + Lang.size() + " Phrase(s)");
questers.addAll(getOnlineQuesters());
if (depends.getCitizens() != null) {
if (depends.getCitizens().getNPCRegistry() == null) {
getLogger().log(Level.SEVERE, "Citizens was enabled but NPCRegistry was null. Disabling linkage.");
depends.disableCitizens();
}
}
loadModules();
}
}, 5L);