Skip to content

Commit

Permalink
Add migration
Browse files Browse the repository at this point in the history
  • Loading branch information
Warriorrrr committed Jul 21, 2022
1 parent a34340a commit c7842e8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
9 changes: 9 additions & 0 deletions resources/config-migration.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,5 +307,14 @@
"key": "migrate_notifications"
}
]
},
{
"version": "0.98.3.4",
"changes": [
{
"type": "RUNNABLE",
"key": "add_townblocktype_limits"
}
]
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class RunnableMigrations {

public RunnableMigrations() {
BY_NAME.put("migrate_notifications", MIGRATE_NOTIFICATIONS);
BY_NAME.put("add_townblocktype_limits", ADD_TOWNBLOCKTYPE_LIMITS);
}

@Nullable
Expand All @@ -36,4 +37,10 @@ else if (Boolean.parseBoolean(config.getString("notification.notifications_appea
else
config.set("notification.notifications_appear_as", "chat");
};

@SuppressWarnings("unchecked")
private final Consumer<CommentedConfiguration> ADD_TOWNBLOCKTYPE_LIMITS = config -> {
for (Map<?, ?> level : config.getMapList("levels.town_level"))
((Map<String, Object>) level).put("townBlockTypeLimits", new HashMap<>());
};
}

0 comments on commit c7842e8

Please sign in to comment.