Need Help Implenting Custom Data

Got it working - mostly :slightly_smiling:
The only issue is when the data is deserialized after restarting the server, which fails with this exception:

[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: org.spongepowered.api.util.persistence.InvalidDataException: Could not deserialize com.blocklaunch.blwarps.data.WarpData! Don't worry though, we'll try to deserialize the rest of the data.
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at org.spongepowered.common.data.util.DataUtil.deserializeManipulatorList(DataUtil.java:130)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.tileentity.TileEntity.readFromNbt(TileEntity.java:212)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.tileentity.TileEntity.onReadFromNBT(TileEntity.java:191)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.tileentity.TileEntity.func_145839_a(TileEntity.java:63)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.tileentity.TileEntitySign.func_145839_a(TileEntitySign.java:48)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.tileentity.TileEntity.func_145827_c(TileEntity.java:104)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.world.chunk.storage.AnvilChunkLoader.loadEntities(AnvilChunkLoader.java:500)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:41)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraftforge.common.chunkio.ChunkIOProvider.callStage2(ChunkIOProvider.java:12)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraftforge.common.util.AsynchronousExecutor.skipQueue(AsynchronousExecutor.java:344)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraftforge.common.util.AsynchronousExecutor.getSkipQueue(AsynchronousExecutor.java:302)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:12)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:109)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.world.gen.ChunkProviderServer.func_73158_c(ChunkProviderServer.java:84)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.server.MinecraftServer.prepareSpawnArea(MinecraftServer.java:606)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.server.MinecraftServer.func_71222_d(MinecraftServer.java:583)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.server.MinecraftServer.func_71247_a(MinecraftServer.java:449)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:254)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:441)
[09:08:35] [Server thread/INFO] [STDERR]: [org.spongepowered.common.data.util.DataUtil:deserializeManipulatorList:131]: 	at java.lang.Thread.run(Thread.java:745)
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: Caused by: java.lang.NullPointerException
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: 	at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:213)
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: 	at org.spongepowered.api.data.manipulator.mutable.common.AbstractSingleData.<init>(AbstractSingleData.java:59)
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: 	at com.blocklaunch.blwarps.data.WarpData.<init>(WarpData.java:17)
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: 	at com.blocklaunch.blwarps.data.WarpDataManipulatorBuilder.create(WarpDataManipulatorBuilder.java:34)
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: 	at com.blocklaunch.blwarps.data.WarpDataManipulatorBuilder.build(WarpDataManipulatorBuilder.java:22)
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: 	at org.spongepowered.common.data.util.DataUtil.deserializeManipulatorList(DataUtil.java:124)
[09:08:35] [Server thread/INFO] [STDERR]: [java.lang.Throwable:printStackTrace:634]: 	... 19 more

The latest version of my code

Thanks in advance :slight_smile:

This field is null

You shouldn’t be storing references to data objects in the builder.

See here you call create() but the warp field has not been set

I figured that was the case, but how is the create method any use to me if I have no way of passing in a Warp to use in the WarpData constructor?

Typically you use some sort of default. As there is no such thing as a ā€˜default’ warp in this case you’ll have to create an invalid Warp and make sure it always gets replaced with a real data. Looks like you do this for Jackson, it’s basically the same idea.

Random thought. If a plugin writes its own data to player, what happens if that plugin gets removed? Is the server going to throw deserialization errors every time a player joins?

Only the first time. There’s an issue discussing the ramifications of plugin custom data and where it is stored.