Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
add many changers for core and core models
Browse files Browse the repository at this point in the history
start working at plugin downloader.
start thinking about rewriting code...
helldivers is't bad game :D
  • Loading branch information
TOwInOK committed Mar 28, 2024
1 parent b5177a7 commit 5c3ce24
Show file tree
Hide file tree
Showing 28 changed files with 755 additions and 902 deletions.
330 changes: 167 additions & 163 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions config.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[[metaData]]

[metaData.Core]
name = "Purpur"
version = "1.15"
name = "Paper"
version = "1.20.4"
build = "462"
12 changes: 8 additions & 4 deletions config.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[core]
# Выбери один из вариантов: vanilla, spigot, bucket, paper, purpur, forge, neoForge, fabric, folia, waterfall, velocity
provider = "purpur"
version = "1.15"
# build = "459"
# Выбери один из вариантов: vanilla, paper, purpur, forge, neoForge, fabric, folia, waterfall, velocity
provider = "paper"
version = "1.20.4"
# build = "2160"
# Замораживать ли объекты при наличии в системе
freeze = false
force_update = false
Expand All @@ -24,3 +24,7 @@
[additions]
configPluguinsFrom = "[email protected]:TOwInOK/test.git"
key = "SUPEREKLy"
path_to_core = "core/"
# path_to_mods = ""
# path_to_plugins = ""
path_to_configs = "D:/Rust/MinecraftAddonController/config.lock"
13 changes: 9 additions & 4 deletions src/config/additions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,24 @@ pub struct Additions {
pub path_to_mods: String,
#[serde(default = "plugins")]
pub path_to_plugins: String,
#[serde(default = "lock")]
pub path_to_lock: String,
#[serde(default = "configs")]
pub path_to_configs: String,
}

fn core() -> String {
"./core".to_string()
"core".to_string()
}
fn mods() -> String {
"./mods".to_string()
"mods".to_string()
}
fn plugins() -> String {
"./plugins".to_string()
"plugins".to_string()
}
fn configs() -> String {
"./configs".to_string()
"configs.toml".to_string()
}
fn lock() -> String {
"config.lock".to_string()
}
39 changes: 33 additions & 6 deletions src/config/core.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::config::Versions;
use log::info;
use serde::{Deserialize, Serialize};
#[derive(Deserialize, Serialize, Debug, Default, PartialEq, Clone)]
pub struct Core {
Expand All @@ -24,15 +25,41 @@ pub struct Core {
pub enum Provider {
#[default]
Vanilla, // done
Paper,// done
Folia, // done
Paper, // done
Folia, // done
Purpur, // in work, good api
Fabric, // in work, api with out hash
//https://meta.fabricmc.net/v2/versions/game <- version check /v2/versions/intermediary give only stable
// or https://meta.fabricmc.net/v1/versions/game/1.14.4. Если нет версии, ответ пуст.

Forge, //no api
NeoForge, //worst api
Forge, //no api
NeoForge, //worst api
Waterfall, // done
Velocity // done
Velocity, // done
}

impl Provider {
pub async fn get_name(&self) -> String {
match self {
Provider::Vanilla => "Vanilla".to_owned(),
Provider::Paper => "Paper".to_owned(),
Provider::Folia => "Folia".to_owned(),
Provider::Purpur => "Purpur".to_owned(),
Provider::Fabric => "Fabric".to_owned(),
Provider::Forge => "Forge".to_owned(),
Provider::NeoForge => "NeoForge".to_owned(),
Provider::Waterfall => "Waterfall".to_owned(),
Provider::Velocity => "Velocity".to_owned(),
}
}
}

impl Core {
pub async fn freeze(&self) -> bool {
info!("Check freeze and force_update");
if self.freeze && !self.force_update {
info!("Core has iced");
return true;
};
false
}
}
2 changes: 1 addition & 1 deletion src/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pub mod core;
pub mod plugins;
pub mod versions;

use crate::errors::errors::ConfigErrors;
use crate::errors::error::ConfigErrors;
use additions::Additions;
use core::Core;
use log::info;
Expand Down
20 changes: 15 additions & 5 deletions src/config/plugins.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use crate::config::Versions;
use log::info;
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, PartialEq)]
Expand All @@ -23,12 +24,11 @@ pub struct Plugin {
#[derive(Deserialize, Serialize, Debug, Default, PartialEq)]
#[serde(rename_all = "lowercase")]
pub enum Sources {
Bukkit,
Spigot,
Hangar,
Spigot, // bad api
Hangar, // ?
#[default]
Modrinth,
CurseForge,
Modrinth, // Favorite
CurseForge, // ?
}

#[derive(Deserialize, Serialize, Debug, Default, PartialEq)]
Expand All @@ -39,3 +39,13 @@ pub enum Channels {
Beta,
Alpha,
}

impl Plugin {
pub async fn freeze(&self) -> bool {
info!("Check freeze and force_update");
if self.freeze && !self.force_update {
return true;
};
false
}
}
13 changes: 13 additions & 0 deletions src/controller/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
use crate::{config::Config, lock::lock::Lock};

//ff
pub struct Controller<'config, 'lock> {
config: &'config mut Config,
lock: &'lock mut Lock,
}

impl<'config, 'lock> Controller<'config, 'lock> {
pub fn new(config: &'config mut Config, lock: &'lock mut Lock) -> Self {
Self { config, lock }
}
}
Loading

0 comments on commit 5c3ce24

Please sign in to comment.