Skip to content

Commit

Permalink
it is blanketcon ready
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlan404 committed Nov 14, 2023
1 parent f07a034 commit 1225444
Show file tree
Hide file tree
Showing 31 changed files with 622 additions and 333 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/bc23test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
on:
workflow_dispatch

name: Test bc23
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup toolchain install stable
- uses: Swatinem/rust-cache@v2
- run: cargo run --quiet run --test
35 changes: 20 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
![downloads](https://img.shields.io/github/downloads/ParadigmMC/mcman/total?logo=github)
[![discord server](https://img.shields.io/discord/1108817072814817410?logo=discord)](https://discord.gg/YFuxNmKvSr)

Powerful Minecraft Server Manager CLI. Easily install jars (server, plugins & mods) and write config files. Docker and git support included.
Powerful Minecraft Server Manager CLI. Easily install jars (server, plugins & mods), write config files, manage worlds and more. Docker and git support included.

## Getting Started

Expand All @@ -20,7 +20,7 @@ Powerful Minecraft Server Manager CLI. Easily install jars (server, plugins & mo
| ------------------------------------------------------------------ | ---------------------------------------------------------------------------------- | ------------------------------------------------------ |

- Join the [discord](https://discord.gg/YFuxNmKvSr) for support!
- 📋 Want an example? Here's [iptfreedom](https://github.com/IPTFreedom/iptfreedom)
- 📋 Some examples can be found under [examples/](./examples/)

Submit a PR or open an issue if you have a mcman-server repository that we can add here!

Expand All @@ -32,32 +32,37 @@ Submit a PR or open an issue if you have a mcman-server repository that we can a
- ✔️ No third-party hosts (metadata/mirrors)
- :octocat: Fully `git`-compatible!
- 🐳 Supports Docker, out of the box
- 📦 Import from or export to [mrpack](./DOCS.md#mcman-import-mrpack-src)s!
- 📦 Import from or export to [packwiz](./DOCS.md#mcman-import-mrpack-src) packs!
- 📦 **Import** from or **export** to `mrpack`s or `packwiz` packs!
- 📚 Supports way too many sources, some are:
- Modrinth, CurseRinth, Spigot, Hangar, Github Releases, Jenkins, Maven
- If you need something else, it even supports custom urls!
- ⚙️ Better configuration files with `config/`!
- Allows you to use **variables** inside your config files
- Use *environment variables* for secrets
- 🛡️ More secure than in-game plugin managers which are prone to permission attacks
- 🌐 Keep worlds as `worlds/*.zip` for git, or set it to be downloaded from somewhere!
- ✨ Managing a network? Use `network.toml` to manage servers' ports, have shared variables, config files, plugins or mods.

## Reviews

"faster than gradle builds"

\- kuylar

"makes even oracle linux usable"

\- PureComedi

"I'm technically a contributor"

\- Trash Panda

## Changelog

whats a semver? /s

### `0.4.0`

- Added [NeoForge](https://neoforged.net/) server type
- Added [Forge](https://forums.minecraftforge.net/) server type
- Added Downloadable type **Maven**
- Added [Hangar](https://hangar.papermc.io/) support
- Improved building process
- Implemented a lockfile to speed things up and fix the remove-issue
- Fixed a bug on `mcman run` which messed up the output when server crashes
- Some downloadables now support variables
- Experimental `add` command
- Experimental `world` feature
- See [#31](https://github.com/ParadigmMC/mcman/issues/31)

### `0.3.0`

Expand Down
39 changes: 0 additions & 39 deletions TODO.md

This file was deleted.

5 changes: 4 additions & 1 deletion examples/network/network.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ name = "CoolNetwork"
proxy = "proxy"
port = 25565

[servers.game1]
port = 25567

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

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

[![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-->

## Mods

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

[jar]
type = "quilt"
loader = "latest"
installer = "latest"

[variables]
PORT = "25565"

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

[options]
upload_to_mclogs = false
8 changes: 5 additions & 3 deletions src/app/caching.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::{path::{PathBuf, Path}, fs::{self, File}, io::Write};

Check warning on line 1 in src/app/caching.rs

View workflow job for this annotation

GitHub Actions / clippy

unused import: `Path`

warning: unused import: `Path` --> src/app/caching.rs:1:27 | 1 | use std::{path::{PathBuf, Path}, fs::{self, File}, io::Write}; | ^^^^

use anyhow::Result;
use anyhow::{Result, Context};
use serde::de::DeserializeOwned;

pub struct Cache(pub PathBuf);
Expand Down Expand Up @@ -37,9 +37,11 @@ impl Cache {
}

pub fn write_json<T: serde::Serialize>(&self, path: &str, data: &T) -> Result<()> {
fs::create_dir_all(PathBuf::from(path).parent().unwrap_or(Path::new(path)))?;
fs::create_dir_all(self.path(path).parent().unwrap())
.context(format!("Creating parent directory for: {path}"))?;
let content = serde_json::to_string(data)?;
let mut f = File::create(self.0.join(path))?;
let mut f = File::create(self.path(path))
.context(format!("Creating cache file at: {path}"))?;
f.write_all(content.as_bytes())?;

Ok(())
Expand Down
4 changes: 2 additions & 2 deletions src/app/downloading.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ impl App {
// file already there and is ok
self.log(format!(
" {} {}",
style("Skipped ").green(),
style(" Skipped").green(),
progress_bar.message()
))?;

Expand Down Expand Up @@ -218,7 +218,7 @@ impl App {
validate_hash(hasher)?;

progress_bar.set_style(ProgressStyle::with_template("{prefix:.green.bold} {msg}")?);
progress_bar.set_prefix("Copied ");
progress_bar.set_prefix(" Copied");
progress_bar.set_message(resolved.filename.clone());
self.log(format!(
" {} {}",
Expand Down
23 changes: 23 additions & 0 deletions src/app/feedback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@ impl App {
))?)
}

pub fn error<S: std::fmt::Display>(&self, message: S) -> Result<()> {
Ok(self.multi_progress.println(format!(
" {} {message}",
style("⚠ Error").red().bold()
))?)
}

pub fn success<S: std::fmt::Display>(&self, message: S) -> Result<()> {
Ok(self.multi_progress.suspend(|| println!(
" {} {message}",
Expand All @@ -37,6 +44,10 @@ impl App {
)))
}

Check warning on line 45 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:40:5 | 40 | / pub fn log<S: std::fmt::Display>(&self, message: S) -> Result<()> { 41 | | Ok(self.multi_progress.suspend(|| println!( 42 | | " {}", 43 | | style(message).dim() 44 | | ))) 45 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps help: remove the return type... | 40 | pub fn log<S: std::fmt::Display>(&self, message: S) -> Result<()> { | ~~~~~~~~~~ help: ...and then remove returned values | 41 - Ok(self.multi_progress.suspend(|| println!( 42 - " {}", 43 - style(message).dim() 44 - ))) 41 + |

pub fn println<S: std::fmt::Display>(&self, message: S) -> Result<()> {
Ok(self.multi_progress.suspend(|| println!("{message}")))
}

Check warning on line 49 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:47:5 | 47 | / pub fn println<S: std::fmt::Display>(&self, message: S) -> Result<()> { 48 | | Ok(self.multi_progress.suspend(|| println!("{message}"))) 49 | | } | |_____^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_wraps help: remove the return type... | 47 | pub fn println<S: std::fmt::Display>(&self, message: S) -> Result<()> { | ~~~~~~~~~~ help: ...and then remove returned values | 48 - Ok(self.multi_progress.suspend(|| println!("{message}"))) 48 + |

pub fn dbg<S: std::fmt::Display>(&self, message: S) -> Result<()> {

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

View workflow job for this annotation

GitHub Actions / clippy

method `dbg` is never used

warning: method `dbg` is never used --> src/app/feedback.rs:51:12 | 9 | impl App { | -------- method in this implementation ... 51 | pub fn dbg<S: std::fmt::Display>(&self, message: S) -> Result<()> { | ^^^
Ok(self.multi_progress.suspend(|| println!(
" {} {}",
Expand Down Expand Up @@ -106,4 +117,16 @@ impl App {

Ok(item.0.clone())
}

pub fn select_with_default<T: Clone>(&self, prompt: &str, items: &[SelectItem<T>], def: usize) -> Result<T> {
let item = &items[self.multi_progress.suspend(|| {
Select::with_theme(&ColorfulTheme::default())
.items(items)
.with_prompt(prompt)
.default(def)
.interact()
})?];

Ok(item.0.clone())
}
}
Loading

0 comments on commit 1225444

Please sign in to comment.