use of fr.neatmonster.nocheatplus.compat.bukkit.MCAccessBukkit in project NoCheatPlus by NoCheatPlus.
the class MCAccessFactory method getMCAccess.
/**
* Get a new MCAccess instance.
* @param bukkitOnly Set to true to force using an API-only module.
* @return
* @throws RuntimeException if no access can be set.
*/
public MCAccess getMCAccess(final MCAccessConfig config) {
final List<Throwable> throwables = new ArrayList<Throwable>();
MCAccess mcAccess = null;
// CraftBukkit (dedicated).
if (config.enableCBDedicated) {
mcAccess = getMCAccessCraftBukkit(throwables);
if (mcAccess != null) {
return mcAccess;
}
}
// CraftBukkit (reflection).
if (config.enableCBReflect) {
try {
return new MCAccessCBReflect();
} catch (Throwable t) {
throwables.add(t);
}
}
// Try to set up api-only access (since 1.4.6).
try {
mcAccess = new MCAccessBukkit();
StaticLog.logWarning("Running in Bukkit-API-only mode (" + Bukkit.getServer().getVersion() + "). If this is not intended, please check for updates and consider to request support.");
for (String uMsg : updateLocs) {
StaticLog.logWarning(uMsg);
}
// if (ConfigManager.getConfigFile().getBoolean(ConfPaths.LOGGING_EXTENDED_STATUS)) {
// log(throwables); // Maybe later activate with TRACE explicitly set
// }
StaticLog.logWarning("Bukkit-API-only mode: Some features will likely not function properly, performance might suffer.");
return mcAccess;
} catch (Throwable t) {
throwables.add(t);
}
// All went wrong.
// TODO: Fall-back solution (disable plugin, disable checks).
StaticLog.logSevere("Your version of NoCheatPlus is not compatible with the version of the server-mod (" + Bukkit.getServer().getVersion() + "). Please check for updates and consider to request support.");
for (String msg : updateLocs) {
StaticLog.logSevere(msg);
}
StaticLog.logSevere(">>> Failed to set up MCAccess <<<");
log(throwables);
// TODO: Schedule disabling the plugin or running in circles.
throw new RuntimeException("Could not set up native access to the server mod, neither to the Bukkit-API.");
}
Aggregations