Started vanilla auto creation

This commit is contained in:
2025-12-06 22:55:06 +01:00
parent f3c7172178
commit 6b2757a52f
10 changed files with 1268 additions and 16 deletions

49
src/server/domain.rs Normal file
View File

@@ -0,0 +1,49 @@
use std::{path::PathBuf, str::FromStr};
use tokio::sync::RwLock;
use uuid::Uuid;
use crate::{
config::{MinecraftType, MinecraftVersion, Version},
error::CreationError,
instance::InstanceHandle,
};
pub struct MineGuardConfig {
uuid: Uuid,
server_dir: PathBuf,
jar_path: PathBuf,
mc_version: MinecraftVersion,
mc_type: MinecraftType,
}
pub struct MineGuardServer {
handle: RwLock<InstanceHandle>,
config: RwLock<MineGuardConfig>,
}
impl MineGuardConfig {
pub fn new() -> Self {
Self {
uuid: Uuid::new_v4(),
server_dir: PathBuf::new(),
jar_path: PathBuf::new(),
mc_version: MinecraftVersion::Release(Version::from_str("0.00.00").unwrap()),
mc_type: MinecraftType::Vanilla,
}
}
}
impl MineGuardServer {
pub fn create(
mc_version: MinecraftVersion,
mc_type: MinecraftType,
directory: PathBuf,
) -> Result<Self, CreationError> {
if !directory.is_dir() {
return Err(CreationError::DirectoryError);
}
todo!()
}
}

1
src/server/mod.rs Normal file
View File

@@ -0,0 +1 @@
pub mod domain;