From 6eb138d333ee5371c03282388c4a72c8046e9bda Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 28 Jan 2019 18:48:01 -0500 Subject: [PATCH] Display error for incompatible WorldGuard versions --- .../java/me/blackvein/quests/QuestFactory.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/main/java/me/blackvein/quests/QuestFactory.java b/src/main/java/me/blackvein/quests/QuestFactory.java index 60283e358..6efa9ee04 100644 --- a/src/main/java/me/blackvein/quests/QuestFactory.java +++ b/src/main/java/me/blackvein/quests/QuestFactory.java @@ -621,10 +621,16 @@ public class QuestFactory implements ConversationAbandonedListener { String text = ChatColor.DARK_GREEN + Lang.get("questRegionTitle") + "\n"; boolean any = false; for (World world : plugin.getServer().getWorlds()) { - RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(world); - for (String region : rm.getRegions().keySet()) { - any = true; - text += ChatColor.GREEN + region + ", "; + try { + RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(world); + for (String region : rm.getRegions().keySet()) { + any = true; + text += ChatColor.GREEN + region + ", "; + } + } catch (NoSuchMethodError e) { + String version = plugin.getServer().getPluginManager().getPlugin("").getDescription().getVersion(); + plugin.getLogger().severe("Quests does not currently support regions for WorldGuard " + version); + return ChatColor.RED + Lang.get("questWGNotInstalled"); } } if (any) {