Only use ProtocolLib hooks for Minecraft 1.8.x (until having modules).

This is to prevent nasty errors. At least add support for 1.7.10 with a
compatible version of ProtocolLib will be added.
This commit is contained in:
asofold 2015-11-25 08:18:00 +01:00
parent 55cf5c0a6b
commit 92ecf7ce50
1 changed files with 11 additions and 1 deletions

View File

@ -5,11 +5,14 @@ import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import org.bukkit.Bukkit;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.NoCheatPlus;
import fr.neatmonster.nocheatplus.checks.inventory.FastConsume;
import fr.neatmonster.nocheatplus.checks.inventory.Gutenberg;
import fr.neatmonster.nocheatplus.checks.net.protocollib.ProtocolLibComponent;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.config.ConfPaths;
import fr.neatmonster.nocheatplus.config.ConfigManager;
import fr.neatmonster.nocheatplus.logging.StaticLog;
@ -58,7 +61,14 @@ public class DefaultComponentFactory {
// ProtocolLib dependencies.
try {
available.add(new ProtocolLibComponent(plugin));
if (ServerVersion.isMinecraftVersionBetween("1.8", true, "1.9", false)) {
available.add(new ProtocolLibComponent(plugin));
} else {
if (Bukkit.getPluginManager().getPlugin("ProtocolLib") != null) {
StaticLog.logWarning("Can't tell if the packet level hooks are compatible to the version of ProtocolLib in use.");
}
StaticLog.logInfo("Packet level access: ProtocolLib is not available.");
}
} catch (Throwable t){
StaticLog.logInfo("Packet level access: ProtocolLib is not available.");
}