Move API checks into their own class

This commit is contained in:
nossr50
2019-05-13 01:58:27 -07:00
parent b5eb942682
commit 86b98368bc
2 changed files with 22 additions and 16 deletions

View File

@@ -0,0 +1,21 @@
package com.gmail.nossr50.util;
import com.gmail.nossr50.mcMMO;
import java.lang.reflect.Method;
public class CompatibilityCheck {
/**
* Uses reflection to check for incompatible server software
*/
public static void checkForOutdatedAPI(boolean serverAPIOutdated, String software) {
try {
Class<?> checkForClass = Class.forName("org.bukkit.event.block.BlockDropItemEvent");
Method newerAPIMethod = checkForClass.getMethod("getItems");
Class<?> checkForClassBaseComponent = Class.forName("net.md_5.bungee.api.chat.BaseComponent");
} catch (ClassNotFoundException | NoSuchMethodException e) {
serverAPIOutdated = true;
mcMMO.p.getLogger().severe("You are running an older version of " + software + " that is not compatible with mcMMO, update your server software!");
}
}
}