So I’m doing some architectural and testing work for the plugin I’m going to submit to the next plugin competition.
Part of what I need to do is serialize a player’s data and use/manipulate it, and then potentially restoring it at a later point. I’m testing that with a command, see code below.
if(source instanceof Player) {
Player player = (Player) source;
DataContainer container = player.toContainer();
SpongeRunnable.of(() -> { //SpongeRunnable is a wrapper class, and I know it works perfectly
player.setRawData(container);
player.sendMessage(Text.of(TextColors.AQUA, "Backset your data!"));
}).runTaskLater(PluginClass.getOperatingInstance(), 5, TimeUnit.SECONDS); //It's not actually named 'PluginClass,' but if I used the actual name, I'd be revealing what my new plugin will do.
}
return CommandResult.success();
Whenever I run the above command, the text is shown to me, but none of the data seems to reset. Location is not restored and neither are potion effects.
Any help is appreciated. Is it just unimplemented, and if so, when will it be implemented?
Edit: did some looking around, and it seems that either the Mixin
s don’t implement this method, or provide a completely empty method body. Does anyone know of another method to do this?