/** * Create a default configuration file from the .jar. * * @param name the filename */ protected void createDefaultConfiguration(String name) { File actual = new File(getDataFolder(), name); if (!actual.exists()) { try (JarFile file = new JarFile(getFile())) { ZipEntry copy = file.getEntry("defaults/" + name); if (copy == null) throw new FileNotFoundException(); copyDefaultConfig(file.getInputStream(copy), actual, name); } catch (IOException e) { getLogger().severe("Unable to read default configuration: " + name); } } }
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) { log.log(Level.WARNING, "Failed to search path for Bukkit adapters"); } try { adapterLoader.addFromJar(getFile()); } catch (IOException e) { log.log(Level.WARNING, "Failed to search " + getFile() + " for Bukkit adapters", e); } try { bukkitAdapter = adapterLoader.loadAdapter(); log.log(Level.INFO, "Using " + bukkitAdapter.getClass().getCanonicalName() + " as the Bukkit adapter"); } catch (AdapterLoadException e) { Platform platform = worldEdit.getPlatformManager().queryCapability(Capability.WORLD_EDITING); if (platform instanceof BukkitServerInterface) { log.log(Level.WARNING, e.getMessage()); } else { log.log(Level.INFO, "WorldEdit could not find a Bukkit adapter for this MC version, " + "but it seems that you have another implementation of WorldEdit installed (" + platform.getPlatformName() + ") " + "that handles the world editing."); } } }