Grab the version of WG in a better way

This commit is contained in:
nossr50 2019-02-05 20:23:20 -08:00
parent 36f75457e3
commit 577e3339f1
2 changed files with 16 additions and 15 deletions

View File

@ -6,6 +6,9 @@ Key:
= Fix
! Change
- Removal
Version 2.2.0
Fixed a bug where grabbing the version of WG would throw classnotdefined errors
Version 2.1.8
mcMMO now checks for WG 7 before attempting to use the WG API
Made some optimizations for our WG integration

View File

@ -21,18 +21,6 @@ public class WorldGuardUtils {
if (plugin == null) {
return false; // Maybe you want throw an exception instead
}
if(!WorldGuard.getVersion().startsWith("7"))
{
if(!hasWarned)
{
mcMMO.p.getLogger().severe("mcMMO only supports WorldGuard version 7! Make sure you have WG 7! This warning will not appear again.");
hasWarned = true;
}
return false; // WG 7 is required
}
} catch (Exception e) {
e.printStackTrace();
//Silently Fail
@ -53,10 +41,20 @@ public class WorldGuardUtils {
if(plugin instanceof WorldGuardPlugin)
{
worldGuardPluginRef = (WorldGuardPlugin) plugin;
if(plugin.getDescription().getVersion().startsWith("7"))
{
worldGuardPluginRef = (WorldGuardPlugin) plugin;
if(worldGuardPluginRef != null)
isLoaded = true;
if(worldGuardPluginRef != null)
isLoaded = true;
} else {
if(!hasWarned)
{
mcMMO.p.getLogger().severe("mcMMO only supports WorldGuard version 7! Make sure you have WG 7! This warning will not appear again.");
hasWarned = true;
}
}
}
return worldGuardPluginRef;