From 966a5e1c55b4ddb64e1b6cb8242723a7d7028309 Mon Sep 17 00:00:00 2001 From: Ceikry Date: Sun, 15 May 2022 23:22:30 +0000 Subject: [PATCH] Fixed the load order of configs with plugins - many configs are now loaded after plugins so that npc/item/object handlers in the old plugin system are set properly --- .../src/main/kotlin/rs09/game/system/config/ConfigParser.kt | 4 +++- Server/src/main/kotlin/rs09/game/world/GameWorld.kt | 3 ++- Server/src/test/kotlin/TestUtils.kt | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Server/src/main/kotlin/rs09/game/system/config/ConfigParser.kt b/Server/src/main/kotlin/rs09/game/system/config/ConfigParser.kt index 5f9b0b910..b9d49e86d 100644 --- a/Server/src/main/kotlin/rs09/game/system/config/ConfigParser.kt +++ b/Server/src/main/kotlin/rs09/game/system/config/ConfigParser.kt @@ -4,12 +4,14 @@ import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.launch class ConfigParser { - fun parseConfigs() { + fun prePlugin() { NPCConfigParser().load() ItemConfigParser().load() ObjectConfigParser().load() XteaParser().load() InterfaceConfigParser().load() + } + fun postPlugin() { ShopParser().load() DropTableParser().load() NPCSpawner().load() diff --git a/Server/src/main/kotlin/rs09/game/world/GameWorld.kt b/Server/src/main/kotlin/rs09/game/world/GameWorld.kt index 4ef4db688..aeefd8d5c 100644 --- a/Server/src/main/kotlin/rs09/game/world/GameWorld.kt +++ b/Server/src/main/kotlin/rs09/game/world/GameWorld.kt @@ -160,11 +160,12 @@ object GameWorld { Cache.init(ServerConstants.CACHE_PATH) databaseManager = DatabaseManager(ServerConstants.DATABASE) databaseManager!!.connect() - ConfigParser().parseConfigs() + configParser.prePlugin() ClassScanner.scanClasspath() ClassScanner.loadPureInterfaces() worldPersists.forEach { it.parse() } ClassScanner.loadSideEffectfulPlugins() + configParser.postPlugin() startupListeners.forEach { it.startup() } if (run) { SystemManager.flag(if (settings?.isDevMode == true) SystemState.PRIVATE else SystemState.ACTIVE) diff --git a/Server/src/test/kotlin/TestUtils.kt b/Server/src/test/kotlin/TestUtils.kt index 2f1e8bea8..002d115c0 100644 --- a/Server/src/test/kotlin/TestUtils.kt +++ b/Server/src/test/kotlin/TestUtils.kt @@ -47,7 +47,8 @@ object TestUtils { if(ServerConstants.DATA_PATH == null) { ServerConfigParser.parse(this::class.java.getResource("test.conf")) Cache.init(this::class.java.getResource("cache").path.toString()) - ConfigParser().parseConfigs() + ConfigParser().prePlugin() + ConfigParser().postPlugin() } }