From c9e686b1dd378d7e37db154175e2384840a754f5 Mon Sep 17 00:00:00 2001 From: PikaMug Date: Tue, 24 Sep 2019 01:27:16 -0400 Subject: [PATCH] Continue to attempt to load Citizens post-initialization, fixes #934 --- .../java/me/blackvein/quests/Dependencies.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/main/src/main/java/me/blackvein/quests/Dependencies.java b/main/src/main/java/me/blackvein/quests/Dependencies.java index 0c51ea744..f54f52cdd 100644 --- a/main/src/main/java/me/blackvein/quests/Dependencies.java +++ b/main/src/main/java/me/blackvein/quests/Dependencies.java @@ -89,6 +89,15 @@ public class Dependencies { } public CitizensPlugin getCitizens() { + if (citizens == null) { + if (isPluginAvailable("Citizens")) { + try { + citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens"); + } catch (Exception e) { + plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled."); + } + } + } return citizens; } @@ -124,12 +133,12 @@ public class Dependencies { } void init() { - try { - if (isPluginAvailable("Citizens")) { + if (isPluginAvailable("Citizens")) { + try { citizens = (CitizensPlugin) plugin.getServer().getPluginManager().getPlugin("Citizens"); + } catch (Exception e) { + plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled."); } - } catch (Exception e) { - plugin.getLogger().warning("Legacy version of Citizens found. Citizens in Quests not enabled."); } if (isPluginAvailable("WorldGuard")) { worldGuardApi = new WorldGuardAPI(plugin.getServer().getPluginManager().getPlugin("WorldGuard"));