Custom data can not be removed

Hello, I am having an issue trying to remove custom data from players. Running remove(MyData.class) does not seem to remove the data from the player. Using an NBT program to view the player data shows that my data is still there, even after a server shutdown.

However, when using some debugging Sponge seems to show that the data was removed:

player.getContainers(); // Contains MyData.class
player.remove(MyData.class);
player.getContainers(); // Does not contain MyData.class

It seems like the change is never written the disk. Does anyone know how I can solve this issue?

Is the player data saved after you removed the custom data? I’m fairly sure that the removal code is in fact removing the custom data from the list of DataManipulators, at which point it can’t be re-serialized over again.

How can I tell if it is saved? Is there is a way to force the save of data?

I think I see the problem, funny how it’s never been noticed before. I’ll have to test and see if my thoughts are correct.

1 Like

I see you’ve fixed the issue in the latest SpongeForge commits for API 4. If possible, could you please merge that into bleeding so SpongeForge for API 5 will be fixed as well?

We regularly merge the changes to API 4 into API 5 in batches if possible - give it a few days.

Scratch that, already merged :slight_smile:

1 Like