Add a setting to retain projectile owner after hit when owner is disconnected
After building a wireless-activated teleporter on a Purpur server, my friends and I noticed that the teleporter stopped working after re-logging into the server. Interestingly, this mechanism functions correctly in Vanilla Minecraft.
Upon digging into the issue, I discovered that the Owner property of the arrow disappears when the owner logs out. This happens because the arrow continuously collides with an entity (specifically, a wind charge), and due to a fix implemented in Paper, the Owner is set to null when the owner is disconnected from the server.
I introduced a configuration option under gameplay-mechanics.retain-projectile-owner-on-hit-if-owner-offline. When enabled, this option prevents the projectile from losing its owner upon hitting an entity while the owner is offline, thereby restoring the expected behavior and ensuring compatibility with redstone contraptions that rely on projectile ownership.
I don't see any major issues, granny or trouble will need to do a full review
If you haven't already, also make a PR to add the new option to the purpur documentation :3
I'm AFK, I will do it tomorrow :)
@Lemonzyy Can you link the paper patch that supposedly causes the owner to be removed?
@YouHaveTrouble
On paper-archive it is patches/server/0803-Refresh-ProjectileSource-for-projectiles.patch.
Maybe you can also pr this to paper as an unsupported-setting? i think they would accept this if it breaks vanilla in some way
Looks like this was the original PR that added the lines you're changing: https://github.com/PaperMC/Paper/pull/9715
That area of the code changed in 1.21.6. Looks like the issue you were running into now happens on vanilla 1.21.6 as well (needs more testing).
Yeah, the issue you're trying to solve now exists on vanilla 1.21.6 (and 1.21.7) as well. I've found two tickets on mojira about it but no confirmation from mojang: MC-299067 & MC-299115
If projectile ownership loss is the correct behavior on Vanilla, I think that there's no need to add my feature. We will have to wait and see.
I feel like it's an oversight on mojang/paper tbh
I think this could still be "fixed" in a different way that doesn't change the same area of the code