Skip to content

Commit

Permalink
Fix config reload -> load function name change
Browse files Browse the repository at this point in the history
  • Loading branch information
0ffz committed May 11, 2021
1 parent de702dd commit 18231b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DeeperWorld : JavaPlugin() {

registerService<WorldManager>(WorldManagerImpl(config))

DeeperConfig
DeeperConfig.load()

registerService<PlayerManager>(PlayerManagerImpl())
registerEvents(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,27 +24,15 @@ object DeeperConfig : IdofrontConfig<DeeperConfig.Data>(deeperWorld, Data.serial
val worlds = sections.map { it.world }.toSet()
}

init {
load()
}

//TODO add a load() function in idofront
fun load() {
data.sections.forEachIndexed { i, section ->
data.sections.getOrNull(i - 1)?.let { prevSection ->
section.aboveKey = prevSection.key
prevSection.belowKey = section.key
override fun ReloadScope.load() {
"Registering all sections with DeeperWorld" {
data.sections.forEachIndexed { i, section ->
data.sections.getOrNull(i - 1)?.let { prevSection ->
section.aboveKey = prevSection.key
prevSection.belowKey = section.key
}
WorldManager.registerSection(section.key, section) //TODO do we need to pass both section key and section?
}
WorldManager.registerSection(section.key, section) //TODO do we need to pass both section key and section?
}
}

override fun ReloadScope.reload() {
attempt(
success = "Registered all sections with DeeperWorld",
fail = "Failed to register sections with DeeperWorld"
) {
load()
}
}
}

0 comments on commit 18231b8

Please sign in to comment.