Skip to content

Commit

Permalink
just some changes
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlan404 committed Nov 13, 2023
1 parent 41dc4b5 commit f07a034
Show file tree
Hide file tree
Showing 34 changed files with 591 additions and 393 deletions.
3 changes: 3 additions & 0 deletions .gitattibutes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

# mcman: use lfs for worlds
**/worlds/*.zip filter=lfs diff=lfs merge=lfs -text
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ site/
.env
# mcman: Exclude exported mrpacks
*.mrpack

# mcman: Exclude local dotenv files
**/.env
10 changes: 10 additions & 0 deletions examples/network/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# CoolNetwork

[![mcman badge](https://img.shields.io/badge/uses-mcman-purple?logo=github)](https://github.com/ParadigmMC/mcman)

<!-- run 'mcman md' to update! -->

## Servers

<!--start:mcman-servers-->
<!--end:mcman-servers-->
9 changes: 9 additions & 0 deletions examples/network/network.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name = "CoolNetwork"
proxy = "proxy"
port = 25565

[servers.lobby]
port = 25566
groups = []

[variables]
13 changes: 13 additions & 0 deletions examples/network/servers/lobby/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# lobby

[![mcman badge](https://img.shields.io/badge/uses-mcman-purple?logo=github)](https://github.com/ParadigmMC/mcman)

<!-- run 'mcman md' to update! -->

<!--start:mcman-server-->
<!--end:mcman-server-->

## Plugins

<!--start:mcman-addons-->
<!--end:mcman-addons-->
2 changes: 2 additions & 0 deletions examples/network/servers/lobby/config/server.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
server-port=${PORT:25565}
motd=${SERVER_NAME:A Minecraft Server}
17 changes: 17 additions & 0 deletions examples/network/servers/lobby/server.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name = "lobby"
mc_version = "1.20.2"

[jar]
type = "paper"
build = "latest"

[variables]
PORT = "25565"

[launcher]
nogui = true
preset_flags = "Aikars"
eula_args = true

[options]
upload_to_mclogs = false
2 changes: 1 addition & 1 deletion res/default_readme
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
## {ADDON_HEADER}

<!--start:mcman-addons-->
<!--end:mcman-addons-->
<!--end:mcman-addons-->
10 changes: 10 additions & 0 deletions res/default_readme_network
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# {NETWORK_NAME}

[![mcman badge](https://img.shields.io/badge/uses-mcman-purple?logo=github)](https://github.com/ParadigmMC/mcman)

<!-- run 'mcman md' to update! -->

## Servers

<!--start:mcman-servers-->
<!--end:mcman-servers-->
6 changes: 6 additions & 0 deletions src/app/feedback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ impl App {
)))
}

Check warning on line 54 in src/app/feedback.rs

View workflow job for this annotation

GitHub Actions / clippy

this function's return value is unnecessary

warning: this function's return value is unnecessary --> src/app/feedback.rs:48:5 | 48 | / pub fn print_job(&self, job: &str) -> Result<()> { 49 | | Ok(self.multi_progress.suspend(|| println!( 50 | | "{} {}", 51 | | ColorfulTheme::default().active_item_prefix, 52 | | style(job).cyan().bold() 53 | | ))) 54 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps help: remove the return type... | 48 | pub fn print_job(&self, job: &str) -> Result<()> { | ~~~~~~~~~~ help: ...and then remove returned values | 49 - Ok(self.multi_progress.suspend(|| println!( 50 - "{} {}", 51 - ColorfulTheme::default().active_item_prefix, 52 - style(job).cyan().bold() 53 - ))) 49 + |

pub fn ci(&self, cmd: &str) {
if std::env::var("CI").ok() == Some("true".to_owned()) {
self.multi_progress.suspend(|| println!("{cmd}"))

Check warning on line 58 in src/app/feedback.rs

View workflow job for this annotation

GitHub Actions / clippy

consider adding a `;` to the last statement for consistent formatting

warning: consider adding a `;` to the last statement for consistent formatting --> src/app/feedback.rs:58:13 | 58 | self.multi_progress.suspend(|| println!("{cmd}")) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: add a `;` here: `self.multi_progress.suspend(|| println!("{cmd}"));` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#semicolon_if_nothing_returned
}
}

pub fn prompt_string(&self, prompt: &str) -> Result<String> {
Ok(self.multi_progress.suspend(|| {
Input::with_theme(&ColorfulTheme::default())
Expand Down
2 changes: 2 additions & 0 deletions src/app/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ impl App {
}

Check failure on line 141 in src/app/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

manual implementation of `Option::map`

error: manual implementation of `Option::map` --> src/app/mod.rs:127:17 | 127 | / if let Some(nw) = &self.network { 128 | | Some("# generated by mcman\nservers:".to_owned() + &nw.servers.iter().map(|(name, serv)| 129 | | format!( 130 | | " {name}:\n motd: {}\n address: {}:{}\n restricted: false", ... | 140 | | None 141 | | } | |_________________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#manual_map help: try | 127 ~ self.network.as_ref().map(|nw| "# generated by mcman\nservers:".to_owned() + &nw.servers.iter().map(|(name, serv)| 128 + format!( 129 + " {name}:\n motd: {}\n address: {}:{}\n restricted: false", 130 + self.var("MOTD").unwrap_or("a mcman-powered server".to_owned()), 131 + std::env::var(format!("IP_{name}")).ok() 132 + .or(serv.ip_address.clone()) 133 + .unwrap_or("127.0.0.1".to_owned()), 134 + std::env::var(format!("PORT_{name}")).ok() 135 + .unwrap_or(serv.port.to_string()), 136 + ) 137 + ).collect::<Vec<_>>().join("\n")) |
},

// why not
"TECHNOBLADE" => Some("Technoblade never dies".to_owned()),
"denizs_gf" => Some("ily may".to_owned()),

k => if let Some(v) = std::env::var(k).ok() {

Check failure on line 148 in src/app/mod.rs

View workflow job for this annotation

GitHub Actions / clippy

matching on `Some` with `ok()` is redundant

error: matching on `Some` with `ok()` is redundant --> src/app/mod.rs:148:18 | 148 | k => if let Some(v) = std::env::var(k).ok() { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#match_result_ok help: consider matching on `Ok(v)` and removing the call to `ok` instead | 148 | k => if let Ok(v) = std::env::var(k) { | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Some(v)
Expand Down
4 changes: 2 additions & 2 deletions src/commands/export/mrpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::path::PathBuf;

use anyhow::{Context, Result};

use crate::app::App;
use crate::{app::App, interop::mrpack::MRPackWriter};

#[derive(clap::Args)]
pub struct Args {
Expand Down Expand Up @@ -33,7 +33,7 @@ pub async fn run(mut app: App, args: Args) -> Result<()> {
let output_file =
std::fs::File::create(output_filename).context("Creating mrpack output file")?;

app.mrpack().export_all(output_file).await?;
app.mrpack().export_all(MRPackWriter::from_writer(output_file)).await?;

Ok(())
}
4 changes: 2 additions & 2 deletions src/commands/import/mrpack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use anyhow::Result;
use indicatif::ProgressBar;
use tempfile::Builder;

use crate::app::App;
use crate::{app::App, interop::mrpack::MRPackReader};

#[derive(clap::Args)]
pub struct Args {
Expand All @@ -25,7 +25,7 @@ pub async fn run(mut app: App, args: Args) -> Result<()> {
std::fs::File::open(path)?
};

app.mrpack().import_all(f, None).await?;
app.mrpack().import_all(MRPackReader::from_reader(f)?, None).await?;

app.save_changes()?;
app.refresh_markdown().await?;
Expand Down
51 changes: 0 additions & 51 deletions src/commands/init/init.rs

This file was deleted.

Loading

0 comments on commit f07a034

Please sign in to comment.