mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-25 22:56:45 +01:00
compatibility with FAWE ( :| )
This commit is contained in:
parent
e14c53d3ca
commit
101b0671fe
@ -1,6 +1,7 @@
|
|||||||
Version 2.1.108
|
Version 2.1.108
|
||||||
Fixed an amusing exploit for easy leveling in Acrobatics
|
Fixed an amusing exploit for easy leveling in Acrobatics
|
||||||
mcMMO should no longer break if FAWE is being used in conjunction with WG on the server
|
mcMMO should no longer break if FAWE is being used in conjunction with WG on the server
|
||||||
|
Improved WG compatibility, mcMMO will now check if WG has loaded properly before hooking into it, which will prevent mcMMO from breaking if WG could not load properly.
|
||||||
mcMMO now loads after worlds do during start up (which is what it should be doing)
|
mcMMO now loads after worlds do during start up (which is what it should be doing)
|
||||||
|
|
||||||
NOTES:
|
NOTES:
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.gmail.nossr50.worldguard;
|
package com.gmail.nossr50.worldguard;
|
||||||
|
|
||||||
|
import com.gmail.nossr50.mcMMO;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
import com.sk89q.worldedit.bukkit.BukkitAdapter;
|
||||||
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
import com.sk89q.worldedit.bukkit.BukkitPlayer;
|
||||||
import com.sk89q.worldguard.WorldGuard;
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
@ -85,6 +86,7 @@ public class WorldGuardManager {
|
|||||||
|
|
||||||
public void registerFlags()
|
public void registerFlags()
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
|
FlagRegistry registry = WorldGuard.getInstance().getFlagRegistry();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -101,6 +103,9 @@ public class WorldGuardManager {
|
|||||||
// could cause issues with saved flags in region files. it's better
|
// could cause issues with saved flags in region files. it's better
|
||||||
// to print a message to let the server admin know of the conflict
|
// to print a message to let the server admin know of the conflict
|
||||||
}
|
}
|
||||||
|
} catch (NoClassDefFoundError e) {
|
||||||
|
System.out.println("[mcMMO] Could not register WG Flags!"); //Don't use the Logger here
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
package com.gmail.nossr50.worldguard;
|
package com.gmail.nossr50.worldguard;
|
||||||
|
|
||||||
import com.gmail.nossr50.mcMMO;
|
import com.gmail.nossr50.mcMMO;
|
||||||
|
import com.sk89q.worldguard.WorldGuard;
|
||||||
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
import com.sk89q.worldguard.bukkit.WorldGuardPlugin;
|
||||||
|
import com.sk89q.worldguard.protection.flags.registry.SimpleFlagRegistry;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -93,6 +95,8 @@ public class WorldGuardUtils {
|
|||||||
*/
|
*/
|
||||||
private static boolean isCompatibleVersion(Plugin plugin) {
|
private static boolean isCompatibleVersion(Plugin plugin) {
|
||||||
//Check that the version of WG is at least version 7.xx
|
//Check that the version of WG is at least version 7.xx
|
||||||
|
boolean allClassesFound = true;
|
||||||
|
|
||||||
if (!plugin.getDescription().getVersion().startsWith("7")) {
|
if (!plugin.getDescription().getVersion().startsWith("7")) {
|
||||||
markWGIncompatible();
|
markWGIncompatible();
|
||||||
} else {
|
} else {
|
||||||
@ -100,16 +104,30 @@ public class WorldGuardUtils {
|
|||||||
for(String classString : WGClassList) {
|
for(String classString : WGClassList) {
|
||||||
try {
|
try {
|
||||||
Class<?> checkForClass = Class.forName(classString);
|
Class<?> checkForClass = Class.forName(classString);
|
||||||
detectedIncompatibleWG = false; //In case this was set to true previously
|
|
||||||
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
||||||
|
allClassesFound = false;
|
||||||
mcMMO.p.getLogger().severe("Missing WorldGuard class - "+classString);
|
mcMMO.p.getLogger().severe("Missing WorldGuard class - "+classString);
|
||||||
markWGIncompatible();
|
markWGIncompatible();
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
/*
|
||||||
|
* If WG appears to have all of its classes we can then check to see if its been initialized properly
|
||||||
|
*/
|
||||||
|
try {
|
||||||
|
if(allClassesFound) {
|
||||||
|
if(!((SimpleFlagRegistry) WorldGuard.getInstance().getFlagRegistry()).isInitialized()) {
|
||||||
|
markWGIncompatible();
|
||||||
|
mcMMO.p.getLogger().severe("WG did not initialize properly, this can cause errors with mcMMO so mcMMO is disabling certain features.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
markWGIncompatible();
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return !detectedIncompatibleWG;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user