MCPcopy Create free account
hub / github.com/Bukkit/Bukkit / getGeneratorForName

Method getGeneratorForName

src/main/java/org/bukkit/WorldCreator.java:219–245  ·  view source on GitHub ↗

Attempts to get the ChunkGenerator with the given name. If the generator is not found, null will be returned and a message will be printed to the specified CommandSender explaining why. The name must be in the "plugin:id" notation, or optionally just "plugin", where "plugin"

(String world, String name, CommandSender output)

Source from the content-addressed store, hash-verified

217 * @return Resulting generator, or null
218 */
219 public static ChunkGenerator getGeneratorForName(String world, String name, CommandSender output) {
220 ChunkGenerator result = null;
221
222 if (world == null) {
223 throw new IllegalArgumentException("World name must be specified");
224 }
225
226 if (output == null) {
227 output = Bukkit.getConsoleSender();
228 }
229
230 if (name != null) {
231 String[] split = name.split(":", 2);
232 String id = (split.length > 1) ? split[1] : null;
233 Plugin plugin = Bukkit.getPluginManager().getPlugin(split[0]);
234
235 if (plugin == null) {
236 output.sendMessage("Could not set generator for world '" + world + "': Plugin '" + split[0] + "' does not exist");
237 } else if (!plugin.isEnabled()) {
238 output.sendMessage("Could not set generator for world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' is not enabled");
239 } else {
240 result = plugin.getDefaultWorldGenerator(world, id);
241 }
242 }
243
244 return result;
245 }
246}

Callers 1

generatorMethod · 0.95

Calls 8

getConsoleSenderMethod · 0.95
getPluginManagerMethod · 0.95
isEnabledMethod · 0.95
getDescriptionMethod · 0.95
getFullNameMethod · 0.80
getPluginMethod · 0.65
sendMessageMethod · 0.65

Tested by

no test coverage detected