Avoid enabling Citizens if NPCRegistry is null, fixes #763

This commit is contained in:
PikaMug 2019-04-08 13:09:24 -04:00
parent 8957c68bdf
commit 7cae9d8560
2 changed files with 5 additions and 2 deletions

View File

@ -32,7 +32,7 @@ public class Dependencies {
private static Heroes heroes = null;
private static PhatLoots phatLoots = null;
private static PlaceholderAPIPlugin placeholder = null;
private static CitizensPlugin citizens;
private static CitizensPlugin citizens = null;
private static Denizen denizen = null;
private static CitizensBooksAPI citizensBooks = null;
private static DungeonsXL dungeons = null;
@ -109,6 +109,9 @@ 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

@ -793,7 +793,7 @@ public class PlayerListener implements Listener {
if (evt.getFrom().getBlock().equals(evt.getTo().getBlock())) {
return;
}
if (plugin.getDependencies().getCitizens() != null && CitizensAPI.getNPCRegistry() != null) {
if (plugin.getDependencies().getCitizens() != null) {
if (CitizensAPI.getNPCRegistry().isNPC(evt.getPlayer())) {
return;
}