Skip to content

Commit

Permalink
add restore
Browse files Browse the repository at this point in the history
  • Loading branch information
CheatCod committed Jul 1, 2023
1 parent c05773c commit c05529b
Showing 1 changed file with 44 additions and 17 deletions.
61 changes: 44 additions & 17 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,23 +156,50 @@ async fn restore_instances(
}
};
debug!("restoring instance: {}", path.display());
if let GameType::MinecraftJava = dot_lodestone_config.game_type() {
let instance = match minecraft::MinecraftInstance::restore(
path.to_owned(),
dot_lodestone_config.clone(),
event_broadcaster.clone(),
macro_executor.clone(),
)
.await
{
Ok(v) => v,
Err(e) => {
error!("Error while restoring instance {} : {e}", path.display());
continue;
}
};
debug!("Restored successfully");
ret.insert(dot_lodestone_config.uuid().to_owned(), instance.into());
match dot_lodestone_config.game_type() {
GameType::MinecraftJava => {
let instance = match minecraft::MinecraftInstance::restore(
path.to_owned(),
dot_lodestone_config.clone(),
event_broadcaster.clone(),
macro_executor.clone(),
)
.await
{
Ok(v) => v,
Err(e) => {
error!(
"Error while restoring Minecraft Java instance {} : {e}",
path.display()
);
continue;
}
};
debug!("Restored Minecraft Java instance successfully");
ret.insert(dot_lodestone_config.uuid().to_owned(), instance.into());
}
GameType::Generic => {
let instance = match generic::GenericInstance::restore(
path.to_owned(),
dot_lodestone_config.clone(),
event_broadcaster.clone(),
macro_executor.clone(),
)
.await
{
Ok(v) => v,
Err(e) => {
error!(
"Error while restoring atom instance {} : {e}",
path.display()
);
continue;
}
};
debug!("Restored Generic instance successfully");
ret.insert(dot_lodestone_config.uuid().to_owned(), instance.into());
}
GameType::MinecraftBedrock => todo!(),
}
}
Ok(ret)
Expand Down

0 comments on commit c05529b

Please sign in to comment.