Bug with player revive 1.18.2
TheMenethil opened this issue ยท 7 comments
Hello !
There is a bug with the mod player revive.
When you are revived by command or by an allie, you still die when you get up.
To reproduce this :
- Die
- Be revived
- Automatically die again
Huh, player revive got updated, didn't notice.
Yeah, the First Aid side of the player revive compat layer was thrown out as for a long time PlayerRevive didn't update to modern versions.
Lol, I saw that you had hard times with this mod..
So will you be able to update it ? These two mods are just the best gameplay changer mods, it could be awesome.
Hi @CreativeMD - Sorry it took so long, but I could now finally take a look at this.
Unfortunally, the time at which the PlayerRevivedEvent is fired has changed.
In 1.18 (and above I guess) it calls setHealth AFTER firing the event, while in 1.12 it calls setHealth and then fires the event.
(See https://github.com/CreativeMD/PlayerRevive/blob/10dd92b53e902c775cb076463891c8fed27d33a9/src/main/java/com/creativemd/playerrevive/server/ReviveEventServer.java#L88 - this is the 1.12 code, which shows setHealth being called before calling the method that fires the event. See https://github.com/CreativeMD/PlayerRevive/blob/569dfda6c033da606921d41fd3a770544dd62524/src/main/java/team/creative/playerrevive/server/PlayerReviveServer.java#L46 for the current code).
It would be the best for me if you could move the event right after the health has been set to zero. This allows me to still intercept this setHealth and react in my own way to set the health to the correct amount.
If there is any change necessary to PlayerRevive necessary to make it work, feel free to let me know.
Yeah thats what I meant. Thanks @CreativeMD.
Fixed in Version 1.11.1 for 1.18.2, 1.19 version should also work once it comes out.
For 1.18.2 to work I did a horrible hack in