feat: change world on slot switch

This commit is contained in:
CyberL1 2024-07-07 14:14:21 +02:00
parent cbecb21ea3
commit b6a73df815
2 changed files with 6 additions and 1 deletions

View File

@ -857,6 +857,11 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Controllers
_context.SaveChanges();
}
var server = new DockerHelper(world);
server.RunCommand($"sed -i 's#level-name=slot-{world.ActiveSlot}#level-name=slot-{sId}#' server.properties");
server.RebootServer();
world.ActiveSlot = sId;
world.Minigame = null;
world.WorldType = nameof(WorldTypeEnum.NORMAL);

View File

@ -128,7 +128,7 @@ namespace Minecraft_Realms_Emulator.Modes.Realms.Helpers
ProcessStartInfo commandProcessInfo = new();
commandProcessInfo.FileName = "docker";
commandProcessInfo.Arguments = $"exec realm-server-{world.Id} {command}";
commandProcessInfo.Arguments = $"exec realm-server-{world.Id} /bin/sh -c \"{command}\"";
Process commandProcess = new();
commandProcess.StartInfo = commandProcessInfo;