Search in sources :

Example 1 with AdapterLoadException

use of com.sk89q.worldedit.bukkit.adapter.AdapterLoadException in project FastAsyncWorldEdit by IntellectualSites.

the class WorldEditPlugin method loadAdapter.

// FAWE end
private void loadAdapter() {
    WorldEdit worldEdit = WorldEdit.getInstance();
    // Attempt to load a Bukkit adapter
    BukkitImplLoader adapterLoader = new BukkitImplLoader();
    try {
        adapterLoader.addFromPath(getClass().getClassLoader());
    } catch (IOException e) {
        LOGGER.warn("Failed to search path for Bukkit adapters");
    }
    try {
        adapterLoader.addFromJar(getFile());
    } catch (IOException e) {
        LOGGER.warn("Failed to search " + getFile() + " for Bukkit adapters", e);
    }
    try {
        BukkitImplAdapter bukkitAdapter = adapterLoader.loadAdapter();
        LOGGER.info("Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter");
        this.adapter.newValue(bukkitAdapter);
    } catch (AdapterLoadException e) {
        Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING);
        if (platform instanceof BukkitServerInterface) {
            LOGGER.warn(e.getMessage());
        } else {
            // FAWE start - Identify as FAWE
            LOGGER.info("FastAsyncWorldEdit could not find a Bukkit adapter for this MC version, " + "but it seems that you have another implementation of FastAsyncWorldEdit installed ({}) " + "that handles the world editing.", platform.getPlatformName());
        // FAWE end
        }
        this.adapter.invalidate();
    }
}
Also used : WorldEdit(com.sk89q.worldedit.WorldEdit) Platform(com.sk89q.worldedit.extension.platform.Platform) BukkitImplAdapter(com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter) BukkitImplLoader(com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader) IOException(java.io.IOException) AdapterLoadException(com.sk89q.worldedit.bukkit.adapter.AdapterLoadException)

Aggregations

WorldEdit (com.sk89q.worldedit.WorldEdit)1 AdapterLoadException (com.sk89q.worldedit.bukkit.adapter.AdapterLoadException)1 BukkitImplAdapter (com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter)1 BukkitImplLoader (com.sk89q.worldedit.bukkit.adapter.BukkitImplLoader)1 Platform (com.sk89q.worldedit.extension.platform.Platform)1 IOException (java.io.IOException)1