Shopkeepers

Shopkeepers

2M Downloads

Dupilicated Villagers of Shopkeepers

blablubbabcDEV opened this issue · 6 comments

commented

Migrated from: https://dev.bukkit.org/projects/shopkeepers/issues/222

Originally posted by Eidalac (Mar 1, 2014):

What steps will reproduce the problem?
1.  Periodically, I will find a named villager walking around matching one of the shopkeepers.
2.  The shopkeeper is fine and working normally.
3.  The villager is just a named duplicate and can be killed with no ill effects.What version of the product are you using?
Shopkeepers v1.16
CraftBukkit version git-Spigot-1323 (MC: 1.7.2)Do you have an error log of what happened?
Nope.Please provide any additional information below.
The duplicate seems random.  Nothing I've seen triggers it.  Sometimes you enter a city and see a named villager wandering around.  I though it was caused by a different plugin I had been using, but I've since re-created the server from scratch without it and have seen it again.I do have Citizens 2 installed, but currently we only have 7 'statue' npcs created with it in a single world, and have seen this issue in other worlds.

commented

Originally commented by Eidalac (Mar 1, 2014):

[at]blablubbabc:
Shops I've seen duplicated:
World Wayun (created with the TerrainControl plugin)
x 272, y104, z-236
x 408 y 101, y-223
World Spawn (normal, ocean only gen, with world border around it)
x -80 y197, z-37
x-85, y197, z-35
Plugins:
http://dev.bukkit.org/bukkit-plugins/acceptrules/
http://bukkitbackup.com/
http://dev.bukkit.org/bukkit-plugins/bar-api/
http://dev.bukkit.org/bukkit-plugins/brewery/
http://dev.bukkit.org/bukkit-plugins/cannons/
http://dev.bukkit.org/bukkit-plugins/chester/
http://dev.bukkit.org/bukkit-plugins/citizens/
http://dev.bukkit.org/bukkit-plugins/compatnocheatplus-cncp/
http://dev.bukkit.org/bukkit-plugins/combatlog/
http://dev.bukkit.org/bukkit-plugins/coreprotect/
http://dev.bukkit.org/bukkit-plugins/crackshot/
http://dev.bukkit.org/bukkit-plugins/creativegates/
http://dev.bukkit.org/bukkit-plugins/drugs/
http://dev.bukkit.org/bukkit-plugins/dynmap/
http://dev.bukkit.org/bukkit-plugins/essentials/
http://dev.bukkit.org/bukkit-plugins/factions/
http://dev.bukkit.org/bukkit-plugins/factionchat/
http://dev.bukkit.org/bukkit-plugins/gringotts/
http://dev.bukkit.org/bukkit-plugins/headhunter/
http://dev.bukkit.org/bukkit-plugins/help-pages/
http://dev.bukkit.org/bukkit-plugins/infernal-mobs/
http://dev.bukkit.org/bukkit-plugins/itemstay/
http://dev.bukkit.org/bukkit-plugins/leveledmobs/
http://dev.bukkit.org/bukkit-plugins/lore/
http://dev.bukkit.org/bukkit-plugins/mcmmo/
http://dev.bukkit.org/bukkit-plugins/mcmmo-tabskillz/
http://dev.bukkit.org/bukkit-plugins/mcore/
http://dev.bukkit.org/bukkit-plugins/movecraft/
http://dev.bukkit.org/bukkit-plugins/multiworld-v-2-0/
http://dev.bukkit.org/bukkit-plugins/nocheatplus/
http://dev.bukkit.org/bukkit-plugins/norain/
http://dev.bukkit.org/bukkit-plugins/terrain-control/
http://dev.bukkit.org/bukkit-plugins/portecoulissante/
http://dev.bukkit.org/bukkit-plugins/shopkeepers/
http://dev.bukkit.org/bukkit-plugins/ticket-man/
http://dev.bukkit.org/bukkit-plugins/vanish/
http://dev.bukkit.org/bukkit-plugins/vault/
http://dev.bukkit.org/bukkit-plugins/wayofshadows/
http://dev.bukkit.org/bukkit-plugins/worldborder/
http://dev.bukkit.org/bukkit-plugins/worldedit/
http://dev.bukkit.org/bukkit-plugins/worldguard/

        Edited Mar 1, 2014
commented

Originally commented by blablubbabc (Mar 7, 2014):

[at]Eidalac:
I think I have found the issue (at least for the duplicating on my server). Breakdown of what happens (in the case I have to review this ticket again in the future):

shopkeeper entity is loaded
some plugin is unloading that chunk without calling a ChunkUnloadEvent: normally Shopkeepers would mark the shop as inactive and remove the entity in this case.

In my case the plugin causing this was Minebackup. I check through your backup plugin but wasn't yet able to find similar "silent chunk unloading".. but I assume for now that it's the same problem in your case.

on disable/server shutdown Shopkeepers deactivates all active shops and removes their entities (just like on ChunkUnload): however, because the chunk already is unloaded the removal of the entity fails (the entity is saved in the world data and will respawn as soon as the chunk gets loaded)
however, Shopkeepers tries to be smart by saving the uuid of the shop's entity and then on the next chunkload search for the old entity and use it instead of spawning a new one
however, Shopkeepers currently assumes that the entity of the active shop was properly removed and decides to NOT store that uuid in that case..

if the plugin now reloads (when the server restarts) and the save file was saved earlier without saving the uuid, and now this chunk is loaded it will not be able to identify the old entity as shop entity and spawns a new one

This is also the reason why this issue seemed so unpredictable and wasn't reproduceable earlier:

The shopkeeper has to be active first (the chunk getting loaded), then some other plugin must silently unload the chunk, while the server didn't unload the chunk itself yet, and then shopkeepers must trigger a save (which removes the old saved uuid), for example by a server restart / plugin reload.
So if this is really the issue I should be able to fix it in the next version, for example by either still saving the old known entity uuid or making sure that the chunk is loaded before attempting to remove the entity, to make sure the villager really gets removed.

commented

Originally commented by blablubbabc (Mar 11, 2014):

Please check out v1.17.1 and report back if that fixed it for you

commented

Originally commented by blablubbabc (Mar 15, 2014):

Could you tell me if you have set 'enableautosave' to true or false in the bukkitbackup plugin config?

commented

Originally commented by blablubbabc (Mar 1, 2014):

I am having the same issue on my server, but wasn't yet able to find out what is causing it.. :(
Maybe you could provide me the coordinates of the shopkeeper(s) which frequently clone themselve, as well as a list of your plugins (especially plugins related to worlds and saving). I am currently checking if the shopkeepers are maybe cloning only near to chunk borders, but wasn't yet able to confirm this "theory".

        Edited Mar 1, 2014
commented

Originally closed by blablubbabc (Mar 11, 2014)