Skip to content

Align pending-death XP logic and runtime config snapshot usage#31

Merged
Alexteens24 merged 4 commits into
mainfrom
copilot/scan-plugin-and-evaluate
Apr 13, 2026
Merged

Align pending-death XP logic and runtime config snapshot usage#31
Alexteens24 merged 4 commits into
mainfrom
copilot/scan-plugin-and-evaluate

Conversation

Copilot AI commented Apr 13, 2026

Copy link
Copy Markdown
Contributor

Static analysis highlighted a logic mismatch in XP handling and configuration reads that could cause inconsistent behavior across death-resolution paths. This PR consolidates those paths so runtime decisions use a single XP model and the active DKIConfig snapshot.

  • XP handling parity in pending-death resolution

    • Standardized XP computation to calculateTotalExperience(savedLevel, savedExp) across grave and natural-drop fallback flows.
    • Removed fallback approximation logic that could diverge from stored pending-death state.
  • Runtime config reads moved to snapshot

    • Replaced selected hot-path getConfig() reads with plugin.getDKIConfig() in core runtime components (DynamicKeepInvPlugin, IntegrationManager, CommandCompleter, CommandDispatcher, StatsGUI, PendingDeathManager).
    • Reduces mixed config-source behavior during runtime.
  • Immediate snapshot refresh after command-driven config writes

    • After command enable/disable/toggle mutations, refreshDKIConfig() is called to keep command behavior and runtime state synchronized.
int xp = calculateTotalExperience(pending.getSavedLevel(), pending.getSavedExp());
if (xp > 0) {
    dropLocation.getWorld().spawn(dropLocation, ExperienceOrb.class, orb -> orb.setExperience(xp));
}

@Alexteens24
Alexteens24 marked this pull request as ready for review April 13, 2026 14:04
@Alexteens24
Alexteens24 merged commit 95dbcf4 into main Apr 13, 2026
2 checks passed
@Alexteens24
Alexteens24 deleted the copilot/scan-plugin-and-evaluate branch April 13, 2026 14:04
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.

2 participants