MCPcopy Create free account
hub / github.com/Teneted/Tenet / getGeneratorForName

Method getGeneratorForName

src/main/java/org/bukkit/WorldCreator.java:355–382  ·  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"

(@NotNull String world, @Nullable String name, @Nullable CommandSender output)

Source from the content-addressed store, hash-verified

353 * @return Resulting generator, or null
354 */
355 @Nullable
356 public static ChunkGenerator getGeneratorForName(@NotNull String world, @Nullable String name, @Nullable CommandSender output) {
357 ChunkGenerator result = null;
358
359 if (world == null) {
360 throw new IllegalArgumentException("World name must be specified");
361 }
362
363 if (output == null) {
364 output = Bukkit.getConsoleSender();
365 }
366
367 if (name != null) {
368 String[] split = name.split(":", 2);
369 String id = (split.length > 1) ? split[1] : null;
370 Plugin plugin = Bukkit.getPluginManager().getPlugin(split[0]);
371
372 if (plugin == null) {
373 output.sendMessage("Could not set generator for world '" + world + "': Plugin '" + split[0] + "' does not exist");
374 } else if (!plugin.isEnabled()) {
375 output.sendMessage("Could not set generator for world '" + world + "': Plugin '" + plugin.getDescription().getFullName() + "' is not enabled");
376 } else {
377 result = plugin.getDefaultWorldGenerator(world, id);
378 }
379 }
380
381 return result;
382 }
383}

Callers 1

generatorMethod · 0.95

Calls 9

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

Tested by

no test coverage detected