mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2024-11-26 12:35:39 +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) {
|
public void addWorld(String worldName) {
|
||||||
ConfigurationSection worldConfigSection = worldsConfigFile.getWorldConfigSection(worldName);
|
WorldConfig worldConfig = worldsConfigFile.getWorldConfig(worldName);
|
||||||
WorldConfig worldConfig = new WorldConfig(worldConfigSection);
|
|
||||||
//todo
|
//todo
|
||||||
saveWorldsConfig();
|
saveWorldsConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadWorld(String worldName) {
|
public void loadWorld(String worldName) {
|
||||||
ConfigurationSection worldConfigSection = worldsConfigFile.getWorldConfigSection(worldName);
|
WorldConfig worldConfig = worldsConfigFile.getWorldConfig(worldName);
|
||||||
WorldConfig worldConfig = new WorldConfig(worldConfigSection);
|
|
||||||
//todo
|
//todo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,6 +49,10 @@ public class WorldsConfigFile {
|
|||||||
? worldConfig.getConfigurationSection(worldName) : worldConfig.createSection(worldName);
|
? worldConfig.getConfigurationSection(worldName) : worldConfig.createSection(worldName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WorldConfig getWorldConfig(String worldName) {
|
||||||
|
return new WorldConfig(getWorldConfigSection(worldName));
|
||||||
|
}
|
||||||
|
|
||||||
public void deleteWorldConfigSection(String worldName) {
|
public void deleteWorldConfigSection(String worldName) {
|
||||||
worldConfig.set(worldName, null);
|
worldConfig.set(worldName, null);
|
||||||
}
|
}
|
||||||
|
@ -38,14 +38,14 @@ class WorldConfigFileTest : TestWithMockBukkit() {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Add a new world to config`() {
|
fun `Add a new world to config`() {
|
||||||
val worldConfig = WorldConfig(worldConfigFile.getWorldConfigSection("newworld"))
|
val worldConfig = worldConfigFile.getWorldConfig("newworld")
|
||||||
worldConfigFile.save()
|
worldConfigFile.save()
|
||||||
compareConfigFile("worlds2.yml", "/newworld_worlds.yml")
|
compareConfigFile("worlds2.yml", "/newworld_worlds.yml")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun `Updating existing world properties`() {
|
fun `Updating existing world properties`() {
|
||||||
val worldConfig = WorldConfig(worldConfigFile.getWorldConfigSection("world"))
|
val worldConfig = worldConfigFile.getWorldConfig("world")
|
||||||
worldConfig.setProperty("adjust-spawn", true)
|
worldConfig.setProperty("adjust-spawn", true)
|
||||||
worldConfig.setProperty("alias", "newalias")
|
worldConfig.setProperty("alias", "newalias")
|
||||||
worldConfigFile.save()
|
worldConfigFile.save()
|
||||||
|
@ -25,7 +25,7 @@ class WorldConfigTest : TestWithMockBukkit() {
|
|||||||
|
|
||||||
worldConfigFile = WorldsConfigFile(multiverseCore)
|
worldConfigFile = WorldsConfigFile(multiverseCore)
|
||||||
worldConfigFile.load()
|
worldConfigFile.load()
|
||||||
worldConfig = WorldConfig(worldConfigFile.getWorldConfigSection("world"))
|
worldConfig = worldConfigFile.getWorldConfig("world")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
Loading…
Reference in New Issue
Block a user