Display error for incompatible WorldGuard versions

This commit is contained in:
BuildTools 2019-01-28 18:48:01 -05:00
parent 361dbfc3ce
commit 6eb138d333

View File

@ -621,10 +621,16 @@ public class QuestFactory implements ConversationAbandonedListener {
String text = ChatColor.DARK_GREEN + Lang.get("questRegionTitle") + "\n"; String text = ChatColor.DARK_GREEN + Lang.get("questRegionTitle") + "\n";
boolean any = false; boolean any = false;
for (World world : plugin.getServer().getWorlds()) { for (World world : plugin.getServer().getWorlds()) {
RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(world); try {
for (String region : rm.getRegions().keySet()) { RegionManager rm = plugin.getDependencies().getWorldGuard().getRegionManager(world);
any = true; for (String region : rm.getRegions().keySet()) {
text += ChatColor.GREEN + region + ", "; 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) { if (any) {