From 7cae9d85606b15be7611037b001152e8f6484db4 Mon Sep 17 00:00:00 2001 From: PikaMug Date: Mon, 8 Apr 2019 13:09:24 -0400 Subject: [PATCH] Avoid enabling Citizens if NPCRegistry is null, fixes #763 --- main/src/main/java/me/blackvein/quests/Dependencies.java | 5 ++++- .../java/me/blackvein/quests/listeners/PlayerListener.java | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/Dependencies.java b/main/src/main/java/me/blackvein/quests/Dependencies.java index 062031a5e..3ba4539cf 100644 --- a/main/src/main/java/me/blackvein/quests/Dependencies.java +++ b/main/src/main/java/me/blackvein/quests/Dependencies.java @@ -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."); diff --git a/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java b/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java index 0edf3566e..b2ced1a98 100644 --- a/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java +++ b/main/src/main/java/me/blackvein/quests/listeners/PlayerListener.java @@ -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; }