mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-10 10:17:38 +01:00
You may now set a generator to a default world using plugin.yml
By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
59c6da8305
commit
92365a5bf2
@ -576,4 +576,33 @@ public final class CraftServer implements Server {
|
||||
public boolean getOnlineMode() {
|
||||
return this.console.onlineMode;
|
||||
}
|
||||
|
||||
public ChunkGenerator getGenerator(String world) {
|
||||
ConfigurationNode node = configuration.getNode("worlds");
|
||||
ChunkGenerator result = null;
|
||||
|
||||
if (node != null) {
|
||||
node = node.getNode(world);
|
||||
|
||||
if (node != null) {
|
||||
String name = node.getString("generator");
|
||||
|
||||
if ((name != null) && (!name.isEmpty())) {
|
||||
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 '" + world + "': Plugin '" + split[0] + "' does not exist");
|
||||
} else if (!plugin.isEnabled()) {
|
||||
getLogger().severe("Could not set generator for default world '" + world + "': Plugin '" + split[0] + "' is not enabled yet (is it load:STARTUP?)");
|
||||
} else {
|
||||
result = plugin.getDefaultWorldGenerator(world, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user