I want have a lobby world.
I want this lobby world can be change in the config.yml.
To load this world, I need to use the command:
WorldCreator lobby = new WorldCreator("MyLobbyWorldName");
Bukkit.createWorld(lobby);
Problem, my current lobby is in the end. So I need to do this:
WorldCreator lobby = new WorldCreator("MyLobbyWorldName");
lobby.environment(World.Environment.THE_END);
Bukkit.createWorld(lobby);
So to put this in my config.yml, I need to put “MyLobbyWorldName” and “World.Environment.THE_END” in my config.yml.
I can put “MyLobbyWorldName” in the config.yml easily.
WorldCreator lobby = new WorldCreator(getConfig().getString("lobby.world.name"));
lobby.environment(World.Environment.THE_END);
Bukkit.createWorld(lobby);
But I don’t now how to formulate the “World.Environment.THE_END” in the config.yml file and how to put it back in the code. Now I have that:
WorldCreator lobby = new WorldCreator(getConfig().getString("lobby.world.name"));
lobby.environment((World.Environment) getConfig().get("lobby.world.environement"));
Bukkit.createWorld(lobby);
but I have an “org.bukkit.configuration.InvalidConfigurationException: could not determine a constructor for the tag tag:yaml.org,2002:org.bukkit.World$Environment
in ‘string’, line 9, column 19:
environement: !!org.bukkit.World$Environment ‘ …” error.
Raphaël M is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.