mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-22 18:47:20 +01:00
Add getWorldConfig method
This commit is contained in:
parent
42eadd91a5
commit
6effeacd1b
@ -29,15 +29,13 @@ public class WorldManager {
|
||||
}
|
||||
|
||||
public void addWorld(String worldName) {
|
||||
ConfigurationSection worldConfigSection = worldsConfigFile.getWorldConfigSection(worldName);
|
||||
WorldConfig worldConfig = new WorldConfig(worldConfigSection);
|
||||
WorldConfig worldConfig = worldsConfigFile.getWorldConfig(worldName);
|
||||
//todo
|
||||
saveWorldsConfig();
|
||||
}
|
||||
|
||||
public void loadWorld(String worldName) {
|
||||
ConfigurationSection worldConfigSection = worldsConfigFile.getWorldConfigSection(worldName);
|
||||
WorldConfig worldConfig = new WorldConfig(worldConfigSection);
|
||||
WorldConfig worldConfig = worldsConfigFile.getWorldConfig(worldName);
|
||||
//todo
|
||||
}
|
||||
|
||||
|
@ -49,6 +49,10 @@ public class WorldsConfigFile {
|
||||
? worldConfig.getConfigurationSection(worldName) : worldConfig.createSection(worldName);
|
||||
}
|
||||
|
||||
public WorldConfig getWorldConfig(String worldName) {
|
||||
return new WorldConfig(getWorldConfigSection(worldName));
|
||||
}
|
||||
|
||||
public void deleteWorldConfigSection(String worldName) {
|
||||
worldConfig.set(worldName, null);
|
||||
}
|
||||
|
@ -38,14 +38,14 @@ class WorldConfigFileTest : TestWithMockBukkit() {
|
||||
|
||||
@Test
|
||||
fun `Add a new world to config`() {
|
||||
val worldConfig = WorldConfig(worldConfigFile.getWorldConfigSection("newworld"))
|
||||
val worldConfig = worldConfigFile.getWorldConfig("newworld")
|
||||
worldConfigFile.save()
|
||||
compareConfigFile("worlds2.yml", "/newworld_worlds.yml")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun `Updating existing world properties`() {
|
||||
val worldConfig = WorldConfig(worldConfigFile.getWorldConfigSection("world"))
|
||||
val worldConfig = worldConfigFile.getWorldConfig("world")
|
||||
worldConfig.setProperty("adjust-spawn", true)
|
||||
worldConfig.setProperty("alias", "newalias")
|
||||
worldConfigFile.save()
|
||||
|
@ -25,7 +25,7 @@ class WorldConfigTest : TestWithMockBukkit() {
|
||||
|
||||
worldConfigFile = WorldsConfigFile(multiverseCore)
|
||||
worldConfigFile.load()
|
||||
worldConfig = WorldConfig(worldConfigFile.getWorldConfigSection("world"))
|
||||
worldConfig = worldConfigFile.getWorldConfig("world")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
Loading…
Reference in New Issue
Block a user