[1.20.1] Add Event SKILL_DOWN and SKILL_CHANGE
deadlymango opened this issue ยท 4 comments
Describe the solution you'd like
Add new events named SKILL_DOWN and SKILL_CHANGE, and repurpose SKILL_UP.
Why is this feature needed
The current implementation in PMMO seems to be that SKILL_UP triggers any time a skill's level changes, whether increasing or decreasing. The idea is that a Perk listening to the event SKILL_DOWN would only fire if that skill went down in level. Under normal gameplay, as I understand it the only way to lose XP and levels is through DEATH (with that one config "Lose Levels On Death" set to true) and commands. I want an event that will trigger only on losing XP to drop a level and that does not require dying.
Then, SKILL_UP could trigger only when the skill's level increases, and then there could be yet another event SKILL_CHANGE that acts just like the current SKILL_UP .
Additional context
Possible issue: If SKILL_UP is renamed to SKILL_CHANGE, this could mean a breaking change for people's configuration files. Possible workaround 1: name the events something else like SKILL_INCREASE and SKILL_DECREASE, and leave SKILL_UP intact for compatibility.
On that note, an idea is that you could implement something like PLAYER_DEATH, so that a perk would run when the player dies (and it is a separate trigger from the reduction of skills' levels); and SKILL_DOWN, so that a perk would run when a skill's level is dropped, most often via commands (and it is a separate trigger from death dropping players' XP down levels)
I could see this causing some apparently strange behavior if someone were to enable the Lose XP on Death config, and then write Perks that watch both PLAYER_DEATH and SKILL_DOWN. Both Perks would trigger. This to me would be intended behavior, so I suppose a modpack developer would simply need to be careful.
4 major Minecraft versions and no one thought that events on death would be a cool feature. I am pleasantly surprised by this. I'll look into this.
