Fix PlayerProfileCache not saving
import net.minecraft.profiler.Snooper;
import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.management.PlayerProfileCache;
import net.minecraft.world.WorldServer;
import net.minecraftforge.common.DimensionManager;
import org.apache.logging.log4j.Logger;
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
import org.spongepowered.common.SpongeImpl;
import org.spongepowered.common.interfaces.IMixinMinecraftServer;
+import org.spongepowered.common.interfaces.server.management.IMixinPlayerProfileCache;
import org.spongepowered.common.interfaces.world.IMixinWorldServer;
import org.spongepowered.common.world.WorldManager;
import org.spongepowered.mod.service.world.SpongeChunkTicketManager;
@Shadow private boolean serverIsRunning;
+ @Shadow public abstract PlayerProfileCache getPlayerProfileCache();
+
@Override
public long[] getWorldTickTimes(int dimensionId) {
return this.worldTickTimes.get(dimensionId);
@@ -122,7 +126,9 @@ public void stopServer()
LOGGER.info("Stopping server");
// Sponge Start - Force player profile cache save
+ ((IMixinPlayerProfileCache) this.getPlayerProfileCache()).setCanSave(true);
((MinecraftServer) (Object) this).getPlayerProfileCache().save();
+ ((IMixinPlayerProfileCache) this.getPlayerProfileCache()).setCanSave(false);
final MinecraftServer server = (MinecraftServer) (Object) this;
if (server.getNetworkSystem() != null)
