Paul19988 / Advanced-Slime-World-Manager

A Spigot plugin that implements the Slime Region Format.
GNU General Public License v3.0
183 stars 71 forks source link

Fix duping issue #164

Closed Teamplayer closed 1 year ago

Teamplayer commented 1 year ago

There is a duping issue that can be reproduced following these steps.

  1. Join a slime world.
  2. Drop items on ground.
  3. Leave slime world.
  4. Join slime world.
  5. Pickup items off ground.
  6. Leave slime world.
  7. Join slime world.

At this point, the item stack that you dropped on step 2 should still be there despite picking it up. This issue doesn't just affect items, but all entities. You can see a demonstration of this dupe here.

This issue seemed to be caused by a change to saving system of entities for 1.19.2. Entities are saved to a map of entity lists when a chunk is unloaded, then loaded from that map when loaded again. When there were no entities in the chunk to store on unload, the map wouldn't be modified, leaving the last thing saved in there to be loaded again on next load.

This is resolved by removing the stored entity list from the map when the chunk has no entities on chunk unload.

This PR also includes a fix to debug messages that weren't printing the proper chunk coordinates. I can move this to a separate PR if required.