use of com.sk89q.worldedit.sponge.adapter.AdapterLoadException in project FastAsyncWorldEdit by IntellectualSites.
the class SpongeWorldEdit method loadAdapter.
private void loadAdapter() {
WorldEdit worldEdit = WorldEdit.getInstance();
// Attempt to load a Sponge adapter
SpongeImplLoader adapterLoader = new SpongeImplLoader();
try {
adapterLoader.addFromPath(getClass().getClassLoader());
} catch (IOException e) {
logger.warn("Failed to search path for Sponge adapters");
}
try {
adapterLoader.addFromJar(container.getSource().get().toFile());
} catch (IOException e) {
logger.warn("Failed to search " + container.getSource().get().toFile() + " for Sponge adapters", e);
}
try {
spongeAdapter = adapterLoader.loadAdapter();
logger.info("Using " + spongeAdapter.getClass().getCanonicalName() + " as the Sponge adapter");
} catch (AdapterLoadException e) {
Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
if (platform instanceof SpongePlatform) {
logger.warn(e.getMessage());
} else {
logger.info("WorldEdit could not find a Sponge adapter for this MC version, " + "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") " + "that handles the world editing.");
}
}
}
Aggregations