Duplicating villagers exploit
Zaino60 opened this issue ยท 3 comments
If you time it correctly, there's a way to dupe the player-owned shops villagers, potentially hurting a skyblock server economy since you have access to infinite villagers very easily...
Here's a video showing exactly how to reproduce the bug: https://www.youtube.com/watch?v=hJ_NxpYdvos
Plugins & Spigot version: https://i.gyazo.com/3c5e9f54e024634069d4c7c75c2b99ec.png
Shopkeepers version: 1.83
My current guess is that this might be a combination of the following 2 problems:
- When you leave the area the chunk gets unloaded, but the Shopkeepers plugin doesn't get informed about the chunk unload and can therefore not properly remove the shopkeeper entity. This would be either an issue with your server version (there have been various chunk-unloading related fixes since 1.8.8, ex. this and especially this), or one of your other plugins is unloading chunks without informing the other plugins.
- The Shopkeepers plugin however contains some fallback logic which should help it to periodically detect 'unnoticed chunk unloads' and to find the previously not properly removed shopkeeper entity and then re-use or properly remove it. However, this might currently only work if the shopkeeper entity is still in the same chunk as it is meant to be.
Could you do the following in order to confirm these 2 issues:
- Enable debug mode (either via config or via command). It should then print a debugging message to the console log whenever shopkeepers get removed due to a chunk unload. Go to the exact position of the shop and note down the chunk coordinates (f3). And then see if you get a chunk-unload message for that chunk in the console log when you leave the area. If not, then there is an issue with your server version or one of your other plugins.
- Also, check if there is a chunk boundary between the shopkeeper's original position and the position you are pushing it to (by comparing the chunk coordinates).
The proper solution would be for the chunk unloading to properly inform plugins, by using a server version which doesn't have this problem, or fixing the plugin causing this (in case a plugin is unloading the chunks).
But if you can confirm these 2 issues, I would be willing to look into whether it is possible to also check neighboring chunks for the not properly removed entity (requires manual chunk loading though, which can cause other issues...), or whether I can finally find a way to make all shopkeeper entities unpushable, across all server versions.
I tested what you said and the plugin detects perfectly when chunks are unloaded. Also I noticed the bug happens only when you are pushing the villager to a different chunk than the one it was originally created at. I'm sure that the fastest and problem-free way to fix this bug would be making so shopkeepers are unpushable.
The next version of Shopkeepers will solve this issue by checking during chunk unloads, if the unloaded chunk contains entities belonging to a shopkeeper in a different chunk, and removing those.
Unfortunely there is no easy way to make entities unpushable, which works across versions, still lets the entities look around, and doesn't require custom entity implementations (which require a lot more work during updating for new minecraft versions). I have a ticket open about this here: #370
Once the update is available, could you try it and report back if this properly fixes this issue in your case?
Also, maybe you could send me your server's timings while there are many players active and lots of chunk unloading happening, preferably in areas with many entities. During my testings the overhead of this fix during chunk unloads was bearable, but I would like to check this with real-world data.
Edit: Should be fixed with v1.84