Search in sources :

Example 1 with IMixinPlayerProfileCache

use of org.spongepowered.common.interfaces.server.management.IMixinPlayerProfileCache in project SpongeCommon by SpongePowered.

the class SpongeInternalListeners method onWorldSave.

@Listener
public void onWorldSave(SaveWorldEvent event) {
    if (Sponge.getServer().getDefaultWorld().isPresent()) {
        if (event.getTargetWorld().getUniqueId().equals(Sponge.getServer().getDefaultWorld().get().getUniqueId())) {
            SpongeUsernameCache.save();
            final MinecraftServer server = SpongeImpl.getServer();
            ((IMixinPlayerProfileCache) server.getPlayerProfileCache()).setCanSave(true);
            server.getPlayerProfileCache().save();
            ((IMixinPlayerProfileCache) server.getPlayerProfileCache()).setCanSave(false);
        }
    }
}
Also used : IMixinPlayerProfileCache(org.spongepowered.common.interfaces.server.management.IMixinPlayerProfileCache) MinecraftServer(net.minecraft.server.MinecraftServer) Listener(org.spongepowered.api.event.Listener)

Aggregations

MinecraftServer (net.minecraft.server.MinecraftServer)1 Listener (org.spongepowered.api.event.Listener)1 IMixinPlayerProfileCache (org.spongepowered.common.interfaces.server.management.IMixinPlayerProfileCache)1