Skip to content

Count exp-table reward skill points in the account pool - #83

Merged
XxFran10xX merged 2 commits into
mainfrom
fix/exp-table-skill-points
Oct 10, 2026
Merged

XxFran10xX merged 2 commits into
mainfrom
fix/exp-table-skill-points

Conversation

@XxFran10xX

Copy link
Copy Markdown
Contributor

Problem

Since Act 1 raised the cap to 11 on Main (2026-10-10), every subclass player who reaches level 7 gets the +2 skill points and then loses them on the next login. Any skill they upgraded with those points drops back to level 1. DrDref (DrdeerX) and Matcha (vMatcha) reported it: they upgraded Bloodlust twice, and after relogging both the upgrades and the points were gone.

The exp tables give the points with command{format="mmocore admin skill-points give %player% 2"}. MMOCore runs that through Bukkit.dispatchCommand, which fires no command event, so SkillPointCommandListener never sees it and the account pool (account-skill-points-total) stays at 0. On the next class apply (join, character load, class change), clampExcessSkillPool sees spent + unspent > 0 and claws the points back. On Main, all 39 players who have claimed the level-7 reward have account-skill-points-total: 0.

Fix

  • ExpTableSkillPoints counts the skill points the current class's claimed exp-table rewards gave. It reads MMOCore's claim counts and the reward's skill-points give commands.
  • ClassService adds the points the account has not counted yet to the pool, and stores what it has counted as account-reward-skill-points in the player file. Each reward counts once per account, so claiming the level-7 reward again under another class adds nothing. Tome and admin points are kept when a later reward arrives.
  • This runs on every class apply, before the clamp. That includes join, so existing accounts are repaired on their next login: the 0-point players get their 2 points back to spend, and the players who still have their upgrades keep them.
  • PlayerManager also runs it one tick after each level-up, because MMOCore claims the reward after it fires the level change.

Testing

  • Unit tests: ExpTableSkillPointsTest (uses real MMOCore ExperienceItem and CommandTrigger objects), plus new cases in ClassServiceTest, PlayerManagerEventsTest and CharacterFieldsRuntimeTest. Locally, everything passes except the 4 POSIX-permission tests that always error on Windows.
  • TFMCDev01 bot test (~/skillpts-test/test.js, with Dev's Berserker cap raised to 11 for the test and then restored):
    • A, DrdeerX's state (level 11, level-7 reward claimed, pool 0, Bloodlust 3): on 2.13.0 Bloodlust was wiped on join and the pool stayed 0. With this branch, Bloodlust stays 3 across two joins and the pool is 2.
    • B, natural level-up from 6: on 2.13.0 the 2 points were gone after a relog. With this branch, the pool is credited and saved right after the level-up, and both points survive a relog.

🤖 Generated with Claude Code

MMOCore runs exp-table command triggers through Bukkit.dispatchCommand, which
fires no command event, so SkillPointCommandListener never saw the level 7
"mmocore admin skill-points give %player% 2" reward. The account pool stayed
at 0 and the next class apply clawed the points back, downgrading any skill
they were spent on.

RPCharacters now counts the skill points the current class's claimed rewards
gave, and adds any it has not counted yet to the account pool. It stores what
it has counted as account-reward-skill-points, so each reward counts once per
account. This runs on every class apply (including join), which repairs
existing accounts, and a tick after each level-up, when MMOCore has claimed
the reward.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 2714bb2c-e2c3-48e2-9976-7a0c3fe0fee1

📥 Commits

Reviewing files that changed from the base of the PR and between e3a4d8e and 0bcbe79.


📒 Files selected for processing (2)
  • src/main/java/net/tfminecraft/rpcharacters/mmocore/ExpTableSkillPoints.java
  • src/test/java/net/tfminecraft/rpcharacters/mmocore/ExpTableSkillPointsTest.java

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.



📝 Summary

Summary by CodeRabbit

  • New Features
    • Skill points earned from class experience rewards are credited to the account pool and remain available when changing or reapplying a class.
    • Previously credited rewards are not counted again, while newly earned rewards can be combined with skill points from other sources.

Walkthrough

The change counts skill points from claimed class experience-table rewards and credits newly claimed points to an account pool. It stores the credited total in player data and saves it through the database. Credit runs during class application or in deferred level-up handling.

Changes

Class reward skill points

Layer / File(s) Summary
Persist the account reward total
src/main/java/net/tfminecraft/rpcharacters/objects/PlayerData.java, src/main/java/net/tfminecraft/rpcharacters/database/PlayerSkillRewardFields.java, src/main/java/net/tfminecraft/rpcharacters/database/Database.java, src/test/java/net/tfminecraft/rpcharacters/database/CharacterFieldsRuntimeTest.java
Player data stores the account reward total. Database loading and saving includes the account-reward-skill-points field. Tests cover missing and malformed values, round-tripping a numeric value, and negative-value clamping.
Count claimed experience-table rewards
src/main/java/net/tfminecraft/rpcharacters/mmocore/ExpTableSkillPoints.java, src/test/java/net/tfminecraft/rpcharacters/mmocore/ExpTableSkillPointsTest.java
ExpTableSkillPoints counts matching skill-point commands in claimed rewards for the current class. Tests cover command matching, claim totals, missing tables, and reflective-read failures.
Credit newly claimed points
src/main/java/net/tfminecraft/rpcharacters/managers/PlayerManager.java, src/main/java/net/tfminecraft/rpcharacters/mmocore/ClassService.java, src/test/java/net/tfminecraft/rpcharacters/managers/PlayerManagerEventsTest.java, src/test/java/net/tfminecraft/rpcharacters/mmocore/ClassServiceTest.java
Class application and deferred level-up handling credit the difference between cumulative claimed rewards and the account’s credited total. Tests cover repeated applications, scheduling, player availability, and saving.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Bug fix

Sequence Diagram(s)

sequenceDiagram
  participant PlayerManager
  participant BukkitScheduler
  participant ClassService
  participant ExpTableSkillPoints
  participant PlayerData
  PlayerManager->>BukkitScheduler: Schedule level-reward credit
  BukkitScheduler->>ClassService: Run credit handler
  ClassService->>ExpTableSkillPoints: Count claimed reward points
  ExpTableSkillPoints-->>ClassService: Return cumulative claimed total
  ClassService->>PlayerData: Add newly claimed points and update credited total
  ClassService->>ClassService: Save player data
Loading

Merge Risk: ⚪ Minimal · up to 0bcbe

The change credits skill points from claimed experience-table rewards. No concrete merge-blocking risk was found in the supplied context.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]
coderabbitai Bot previously approved these changes Oct 10, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 10, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@XxFran10xX
XxFran10xX merged commit de27064 into main Oct 10, 2026
2 checks passed
@XxFran10xX
XxFran10xX deleted the fix/exp-table-skill-points branch October 10, 2026 22:34
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.

1 participant