Skip to content

Commit 18231b8

Browse files
committed
Fix config reload -> load function name change
1 parent de702dd commit 18231b8

File tree

2 files changed

+9
-21
lines changed

2 files changed

+9
-21
lines changed

src/main/java/com/derongan/minecraft/deeperworld/DeeperWorld.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class DeeperWorld : JavaPlugin() {
2929

3030
registerService<WorldManager>(WorldManagerImpl(config))
3131

32-
DeeperConfig
32+
DeeperConfig.load()
3333

3434
registerService<PlayerManager>(PlayerManagerImpl())
3535
registerEvents(

src/main/java/com/derongan/minecraft/deeperworld/config/DeeperConfig.kt

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,27 +24,15 @@ object DeeperConfig : IdofrontConfig<DeeperConfig.Data>(deeperWorld, Data.serial
2424
val worlds = sections.map { it.world }.toSet()
2525
}
2626

27-
init {
28-
load()
29-
}
30-
31-
//TODO add a load() function in idofront
32-
fun load() {
33-
data.sections.forEachIndexed { i, section ->
34-
data.sections.getOrNull(i - 1)?.let { prevSection ->
35-
section.aboveKey = prevSection.key
36-
prevSection.belowKey = section.key
27+
override fun ReloadScope.load() {
28+
"Registering all sections with DeeperWorld" {
29+
data.sections.forEachIndexed { i, section ->
30+
data.sections.getOrNull(i - 1)?.let { prevSection ->
31+
section.aboveKey = prevSection.key
32+
prevSection.belowKey = section.key
33+
}
34+
WorldManager.registerSection(section.key, section) //TODO do we need to pass both section key and section?
3735
}
38-
WorldManager.registerSection(section.key, section) //TODO do we need to pass both section key and section?
39-
}
40-
}
41-
42-
override fun ReloadScope.reload() {
43-
attempt(
44-
success = "Registered all sections with DeeperWorld",
45-
fail = "Failed to register sections with DeeperWorld"
46-
) {
47-
load()
4836
}
4937
}
5038
}

0 commit comments

Comments
 (0)