Abort boot when MB_STATIC_BUILDINGS is missing or unknown
A missing setting threw a NullPointerException, and an unknown one fell back to DB without a word. Both now abort with a message, as MB_STATIC_RUNEGATES does. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
f190af70ad
commit
0bbea064a8
2 files changed
+11
-1
No files matched your search
@@ -3120,6 +3120,7 @@ public class mbEnums {
|
||||
|
||||
// MB_STATIC_BUILDINGS (World Boot Plan 2.4). DB: static buildings from obj_building, before the migration.
|
||||
// PARITY: DB load plus the JSON buildings compared and the migration mapping written. JSON: after the migration.
|
||||
// Required; null when missing or unknown, and boot aborts.
|
||||
public enum StaticBuildingMode {
|
||||
DB,
|
||||
PARITY,
|
||||
@@ -3127,11 +3128,14 @@ public class mbEnums {
|
||||
|
||||
public static StaticBuildingMode fromConfig(String configValue) {
|
||||
|
||||
if (configValue == null)
|
||||
return null;
|
||||
|
||||
for (StaticBuildingMode mode : values())
|
||||
if (mode.name().equalsIgnoreCase(configValue.trim()))
|
||||
return mode;
|
||||
|
||||
return DB;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -557,6 +557,12 @@ public class WorldServer {
|
||||
long start = System.currentTimeMillis();
|
||||
|
||||
staticBuildingMode = StaticBuildingLoader.getMode();
|
||||
|
||||
if (staticBuildingMode == null) {
|
||||
Logger.error("ABORT! MB_STATIC_BUILDINGS is '" + ConfigManager.MB_STATIC_BUILDINGS.getValue() + "'; set it to DB, PARITY or JSON.");
|
||||
exitServer(1);
|
||||
}
|
||||
|
||||
staticZoneRows = DbManager.StaticWorldQueries.COUNT_STATIC_ZONE_ROWS();
|
||||
Logger.info("Static buildings: MB_STATIC_BUILDINGS " + staticBuildingMode + ", " + staticZoneRows + " static zone rows in obj_zone");
|
||||
|
||||
|
||||
Reference in new issue
Block a user