Example #1
0
	private ChunkGenerator getGenerator(int dimID) {
		ConfigurationSection section = bukkitConfig.getConfigurationSection("worlds");
		ChunkGenerator result = null;

		if (section != null) {
			section = section.getConfigurationSection(Integer.toString(dimID));

			if (section != null) {
				String name = section.getString("generator");

				if ((name != null) && (!name.equals(""))) {
					String[] split = name.split(":", 2);
					String id = (split.length > 1) ? split[1] : null;
					Plugin plugin = pluginManager.getPlugin(split[0]);

					if (plugin == null) {
						getLogger().severe("Could not set generator for default world '" + Integer.toString(dimID) + "': Plugin '" + split[0] + "' does not exist");
					} else if (!plugin.isEnabled()) {
						getLogger().severe("Could not set generator for default world '" + Integer.toString(dimID) + "': Plugin '" + split[0] + "' is not enabled yet (is it load:STARTUP?)");
					} else {
						result = plugin.getDefaultWorldGenerator(Integer.toString(dimID), id);
					}
				}
			}
		}

		return result;
	}
 @Override
 public ChunkGenerator getGenerator(final String world, final String name) {
   final Plugin gen_plugin = Bukkit.getPluginManager().getPlugin(name);
   if ((gen_plugin != null) && gen_plugin.isEnabled()) {
     return gen_plugin.getDefaultWorldGenerator(world, "");
   } else {
     return new HybridGen(world);
   }
 }
Example #3
0
 public static ChunkGenerator getGenerator(String worldname, String name) {
   if (name == null) return null;
   String id = "";
   int index = name.indexOf(":");
   if (index != -1) {
     id = name.substring(index + 1);
     name = name.substring(0, index);
   }
   Plugin plug = Bukkit.getServer().getPluginManager().getPlugin(name);
   if (plug != null) {
     return plug.getDefaultWorldGenerator(worldname, id);
   } else {
     return null;
   }
 }