If a villager starts curing while the player who started it, is offline. The player doesnt get a discount. This is due to EntityGetter.getPlayerByUUID returning NULL, since it only searches online players.
Get Zombie Villager in a multiplayer world
Start curing it like normal
Disconnect
Wait for curing to finish
Reconnect
Villager cured, but no discount received
Fix: If the No Online player can be found. Search through offline players aswell. Since in theory this should never be Null, as curing can only be started by a player
Code Analysis (Mojang Mappings 1.18.1)
ZombieVillager.java
EntityGetter.java
VillagerEntity.java
As you can see VillagerEntity.onReputationEventFrom() only uses the UUID from the entities. So changing that argument to be a UUID would allow you to change the code inside of ZombieVillager.java to this:
Which would allow offline players to be saved without much work.
Nothing else uses these calls 😉