}
// VERY Loosely based on work contributed by drew-bahrue (https://github.com/echurchill/CityWorld/pull/2)
public static PasteProvider loadWorldEdit(WorldGenerator generator) {
// return null;
WorldEditPlugin worldEditPlugin = null;
try {
PluginManager pm = Bukkit.getServer().getPluginManager();
worldEditPlugin = (WorldEditPlugin) pm.getPlugin(pluginName);
// not there? darn
if (worldEditPlugin == null)
return null;
// got the right version?
if (!isPlugInVersionOrBetter(generator, worldEditPlugin, pluginMinVersion))
// Use it anyway?
if (generator.settings.forceLoadWorldEdit) {
generator.reportMessage("'" + CityWorldSettings.tagForceLoadWorldEdit + "' setting enabled!");
// Well that didn't work... let's tell the user about a potential workaround
} else {
generator.reportMessage("[PasteProvider] Cannot use the installed WorldEdit. ",
"See the '" + CityWorldSettings.tagForceLoadWorldEdit + "' setting for possible workaround.");
return null;
}
// make sure it is enabled
if (!pm.isPluginEnabled(worldEditPlugin))
pm.enablePlugin(worldEditPlugin);
// woot!
generator.reportMessage("[PasteProvider] Found WorldEdit v" + worldEditPlugin.getDescription().getVersion() + ", enabling its schematics");
return new PasteProvider_WorldEdit(generator);
} catch (Exception e) {
generator.reportException("[PasteProvider] Problem with WorldEdit", e);