Preserve rank configuration and update cage profiles#42
Conversation
| CustomRank custom = CustomRank.fromLegacyRank(legacyRank); | ||
|
|
||
| // Add default permissions based on rank type | ||
| switch (legacyRank) |
There was a problem hiding this comment.
We removed the default permissive assignment? I don't think that's wise considering the discussion we had in the dev chat.
There was a problem hiding this comment.
@Paldiu the ranks.yml in the resources folder contains the correct set of permissions and overwrites this configuration anyways, which fixes the issue
| modified = true; | ||
| } | ||
|
|
||
| String[] prefixKeys = { |
|
|
||
| private void migrateConfigRanks() | ||
| { | ||
| applyConfigPrefix("impostor", ConfigEntry.VAULT_PREFIX_IMPOSTOR); |
There was a problem hiding this comment.
This involves our Vault integration and realistically shouldn't be touched until we understand what we are actually using vault for.
| try { | ||
| ranksConfig.save(ranksFile); | ||
| } catch (IOException ex) { | ||
| FLog.severe("Could not save " + RANKS_FILENAME + ": " + ex.getMessage()); |
There was a problem hiding this comment.
Please prefer to use string formatting over + concatenation.
There was a problem hiding this comment.
I would also like to see us using more """ """ string blocks when possible. They're actually super useful and the newLine byte sent from the quote block is parsed by mini message unlike your classic \n
ajaxvp
left a comment
There was a problem hiding this comment.
Include my other comment even though it's not in the review, thanks!
|
|
||
| block.setType(Material.PLAYER_HEAD); | ||
| final Skull skull = (Skull) block.getState(); | ||
| // setSkullType() is deprecated - setting owner is sufficient for player heads |

Summary
ranks.ymlonly when the file does not already exist/rankconfig reloadused to load them into memoryResolvableProfileAPIWhy
RankManagerpreviously serialized every in-memory rank back into a fresh YAML document. During shutdown or later saves, this could replace direct edits with stale in-memory values and discard unrelated file content. Targeted section updates make persistence explicit while keeping runtime rank checks backed by the loaded in-memory configuration.The cage update replaces the deprecated skull-owner assignment with the current profile API.
Behavior
Direct edits to
ranks.ymlpersist on disk but do not affect live permission checks until/rankconfig reloadis run. Rank-management operations continue to write their affected rank sections to disk.Validation
git diff --checkpassed./gradlew compileJavacould not run locally because the requested Java toolchain is not installed