pufmat / skillsmod

A Minecraft mod that adds a fully configurable skill system to the game.
Other
36 stars 10 forks source link

[Forge - 1.20.1 - 0.12.2]: Skill lock command does not call update for rewards #92

Closed SiverDX closed 2 months ago

SiverDX commented 2 months ago

Locking the category itself works as intended

But if I lock a skill with /puffish_skills skills lock the update(final RewardUpdateContext context) method is not called (neither is dispose)

pufmat commented 2 months ago

I have just tested it and update method is called when the category is locked. I used the following Command Reward to test it and got message lock after locking the category, which means the update was called.

{
    "type": "puffish_skills:command",
    "data": {
        "unlock_command": "say unlock",
        "lock_command": "say lock"
    }
}

Method dispose is called only when the whole reward is no longer needed. For example, it is called when data is reloaded. Keep in mind that rewards are not created per player, but per skill definition. This means that one reward instance handles multiple players.

Not sure if this is related, but thanks to this issue I found a bug where calling SkillsAPI.updateRewards can cause update method to be called on rewards even if the category is locked. Considering built-in rewards it only affects Attribute Reward which is updated by SkillsAPI.updateRewards when the player respawns, so it can cause this reward to be applied even when the category is locked.

SiverDX commented 2 months ago

Locking the category itself works as intended

I meant that as: locking the category itself does work and it calls the proper methods

but the command to lock one singular skill does not call the proper methods

pufmat commented 2 months ago

Oh, sorry I somehow misread that. :sweat_smile:

I have successfully managed to reproduce it now. Thanks for reporting, I'll fix it.

pufmat commented 2 months ago

Fixed in 0.13.0.