Skip to content

Preserve rank configuration and update cage profiles#42

Open
Taahh wants to merge 1 commit into
tfreedomorg:prodfrom
Taahh:devel
Open

Preserve rank configuration and update cage profiles#42
Taahh wants to merge 1 commit into
tfreedomorg:prodfrom
Taahh:devel

Conversation

@Taahh

@Taahh Taahh commented Jul 17, 2026

Copy link
Copy Markdown

Summary

  • copy the bundled ranks.yml only when the file does not already exist
  • persist individual rank updates and deletions without rebuilding the entire configuration from memory
  • preserve direct disk edits, with /rankconfig reload used to load them into memory
  • update Darth cage player heads to use Paper's ResolvableProfile API

Why

RankManager previously 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.yml persist on disk but do not affect live permission checks until /rankconfig reload is run. Rank-management operations continue to write their affected rank sections to disk.

Validation

  • git diff --check passed
  • ./gradlew compileJava could not run locally because the requested Java toolchain is not installed

@Taahh
Taahh marked this pull request as ready for review July 17, 2026 02:56
CustomRank custom = CustomRank.fromLegacyRank(legacyRank);

// Add default permissions based on rank type
switch (legacyRank)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We removed the default permissive assignment? I don't think that's wise considering the discussion we had in the dev chat.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Paldiu the ranks.yml in the resources folder contains the correct set of permissions and overwrites this configuration anyways, which fixes the issue

@videogamesm12
image

modified = true;
}

String[] prefixKeys = {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is also important.


private void migrateConfigRanks()
{
applyConfigPrefix("impostor", ConfigEntry.VAULT_PREFIX_IMPOSTOR);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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());

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please prefer to use string formatting over + concatenation.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ajaxvp left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Irrelevant comment now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants