Skip to content

Commit

Permalink
datapack support and other (fix #9)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheAlan404 committed Jul 19, 2023
1 parent 28997cc commit f6b4390
Show file tree
Hide file tree
Showing 18 changed files with 465 additions and 75 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

145 changes: 134 additions & 11 deletions DOCS.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
<!-- markdownlint-disable MD033 -->
# `mcman` Documentation

You might be looking for [tutorial.md](./TUTORIAL.md)

Index:

- [CLI](#cli)
- [Folder Structure](#folder-structure)
- [Variables](#variables)
- [server.toml](#servertoml)
- [Server Launcher](#server-launcher)
- [Markdown Options](#markdown-options)
- [World](#world) (for datapacks)
- [Downloadables](#downloadable)

## CLI
Expand All @@ -19,7 +24,7 @@ Initializes a new server in the current directory.

This command is interactive. Just run `mcman init`!

The source is the same as one in [`mcman import mrpack`](#mcman-import-mrpack-src)
The mrpack source is the same as one in [`mcman import mrpack`](#mcman-import-mrpack-src)

Example using [Adrenaserver](https://modrinth.com/modpack/adrenaserver):

Expand All @@ -32,21 +37,60 @@ mcman init --mrpack https://cdn.modrinth.com/data/H9OFWiay/versions/2WXUgVhc/Adr

### `mcman version`

Shows the version of mcman.
Show the version and also check for new versions.

### `mcman build`

Builds the server into the [output folder](#folder-structure) using the [`server.toml`](#servertoml) and the `config/` directory.

Alternatively set the output folder manually using `--output "outfolder"` option.
<details>
<summary>Extra flags (skip, force)</summary>

You can alternatively set the output folder manually using `--output <path>` option.

The `--force` flag can be used to not skip and download everything in the config file.

You can use the `--skip <stages>` flag to skip stages.

- Stages should be comma-seperated, like `--skip bootstrap,scripts`
- The stages are: `addons` (plugins and mods), `dp` (datapacks), `bootstrap` (config/) and `scripts`

</details>

### `mcman pull <file>`

'Pulls' a file from `server/` to `config/`

Example usage:

```sh
~/smp $ ls
...
server.toml
...

~/smp $ cd server/config/SomeMod

### `mcman readme`
~/smp/server/config/SomeMod $ mcman pull config.txt
server/config/SomeMod/config.txt => config/config/SomeMod/config.txt
```

### `mcman info`

Shows info about the server in the terminal.

### `mcman markdown`

This command refreshes the server's `README.md` file if there is any.
This command refreshes the markdown files defined in the [server.toml](#markdown-options) files with the templates.

Only the two templates inside the markdown files are refreshed:
**Markdown Templates:**

**Server Info:** This template renders information about the server.
<details>
<summary>
Server Info Table
</summary>

This template renders a table with server jar info.

```md
<!--start:mcman-server-->
Expand All @@ -60,9 +104,14 @@ Example render:
| ------- | ------------------------------------------ | -------- |
| 1.20.1 | [Paper](https://papermc.io/software/paper) | *Latest* |

---
</details>

<details>
<summary>
Addons List
</summary>

**Addons List:** This template renders a list of addons (plugins or mods)
This template renders a list of addons (plugins or mods)

```md
<!--start:mcman-addons-->
Expand All @@ -77,7 +126,7 @@ Example render:
| [BlueMap](https://modrinth.com/plugin/bluemap) | A Minecraft mapping tool that creates 3D models of your Minecraft worlds and displays them in a web viewer. |
| [FastAsyncWorldEdit](https://modrinth.com/plugin/fastasyncworldedit) | Blazingly fast world manipulation for artists, builders and everyone else |

---
</details>

### `mcman import url <URL>`

Expand All @@ -98,6 +147,17 @@ mcman import url https://modrinth.com/plugin/imageframe
mcman import url https://www.spigotmc.org/resources/armorstandeditor-reborn.94503/
```

### `mcman import datapack <URL>`

Like [import url](#mcman-import-url-url), but imports as a datapack rather than a plugin or a mod.

Example usage:

```sh
# datapack alias is dp
mcman import dp https://modrinth.com/plugin/tectonic
```

### `mcman import mrpack <src>`

Imports a [mrpack](https://docs.modrinth.com/docs/modpacks/format_definition/) file (modrinth modpacks)
Expand Down Expand Up @@ -179,7 +239,12 @@ Prefix = "[a]"
# key-value table
```

Or, if your variables are sensitive (such as discord bot tokens) you can use environment variables:
<details>
<summary>
Using environment variables
</summary>

If your variables are sensitive (such as discord bot tokens) you can use environment variables:

```bash
# Linux/Mac:
Expand All @@ -191,8 +256,17 @@ export TOKEN=asdf
set TOKEN=asdf
```

Environment variables are also put onto config files.

</details>

And then use the variables inside any config file inside `config/`:

<details>
<summary>
Example configuration files
</summary>

📜 `config/server.properties`:

```properties
Expand All @@ -218,8 +292,12 @@ messages:
token: ${TOKEN}
```

</details>

### Special Variables

These variables are also present:

- `SERVER_NAME`: name property from server.toml
- `SERVER_VERSION`: mc_version property from server.toml

Expand Down Expand Up @@ -251,6 +329,33 @@ type = "vanilla" # example
# ...
```

**Fields:**

- `name`: string - Name of the server
- `mc_version`: string | `"latest"` - The minecraft version of the server
- `jar`: [Downloadable](#downloadable) - Which server software to use
- `launcher`: [ServerLauncher](#server-launcher) - Options for generating launch scripts
- `plugins`: [Downloadable[]](#downloadable) - A list of plugins to download
- `mods`: [Downloadable[]](#downloadable) - A list of mods to download
- `variables`: table - More info [here](#variables)
- `worlds`: table - Key is world name in string, value is a [World](#world)
- `markdown`: [MarkdownOptions](#markdown-options) - Options for markdown files

### World

> Added in v0.2.2

Represents a world in your server. Currently only exists for datapack support.

```toml
[worlds.skyblock]
datapacks = []
```

**Fields:**

- `datapacks`: [Downloadable[]](#downloadable) - The list of datapacks to download for this world

### Server Launcher

The `[launcher]` table lets mcman create launch scripts for you.
Expand Down Expand Up @@ -291,6 +396,24 @@ hello="thing"
# jvm_args = "-Dhello=thing"
```

### Markdown Options

This category contains the options for markdown rendering via [`mcman md`](#mcman-markdown)

**Fields:**

- `files`: string[] - list of files to render
- `auto_update`: bool - weather to auto-update the files on some commands

```toml
[markdown]
files = [
"README.md",
"PLUGINS.md",
]
auto_update = false
```

## Types

Below are some types used in `server.toml`
Expand Down
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

![mcman](https://media.discordapp.net/attachments/1109215116060266567/1121117662785851522/mcman_large.png)

[![GitHub release](https://img.shields.io/github/release/ParadigmMC/mcman.svg)](https://github.com/ppy/osu/releases/latest)
[![builds](https://img.shields.io/github/actions/workflow/status/ParadigmMC/mcman/build.yml?logo=github)](https://github.com/ParadigmMC/mcman/actions/workflows/build.yml)
[![docker publish](https://img.shields.io/github/actions/workflow/status/ParadigmMC/mcman/publish.yml?logo=github&label=docker%20publish)](https://github.com/ParadigmMC/mcman/actions/workflows/publish.yml)
![GitHub Repo stars](https://img.shields.io/github/stars/ParadigmMC/mcman?logo=github)
Expand All @@ -25,7 +26,8 @@ Powerful Minecraft Server Manager CLI. Easily install jars (server, plugins & mo
- Velocity
- Waterfall
- BungeeCord
- Plugins/Mods:
- Spigot and CraftBukkit
- Plugins/Mods/Datapacks:
- Modrinth
- Spigot
- And even **Github Releases**, **Custom URL**s and **Jenkins!**
Expand All @@ -47,12 +49,17 @@ Powerful Minecraft Server Manager CLI. Easily install jars (server, plugins & mo

- 📋 Want an example? Here's [iptfreedom](https://github.com/IPTFreedom/iptfreedom)

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

## Changelog

### `0.2.2` (unreleased)

- Added support for **Datapacks**
- Added command `mcman import datapack`
- Added **BuildTools** support.
- This includes *spigot, bukkit and craftbukkit*
- Even better docs and tutorial.md

### `0.2.1`

Expand Down
60 changes: 46 additions & 14 deletions TUTORIAL.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
<!-- markdownlint-disable MD033 -->
[latest-win]: https://github.com/ParadigmMC/mcman/releases/download/latest/mcman.exe
[latest-linux]: https://github.com/ParadigmMC/mcman/releases/download/latest/mcman
[latest-win]: https://github.com/ParadigmMC/mcman/releases/latest/download/mcman.exe
[latest-linux]: https://github.com/ParadigmMC/mcman/releases/latest/download/mcman

# Getting Started

## Installation

**Stable Releases:**
**Index:**

| Windows | OSX/Linux |
| :------------------: | :--------------------: |
| [latest][latest-win] | [latest][latest-linux] |
- [Installation](#installation)
- [Recommended Usage](#recommended-usage)
- [Using configuration files](#using-configuration-files)

For past releases, go to the [releases](https://github.com/ParadigmMC/mcman/releases) tab.

**Dev Releases:**
## Installation

We have github [actions](https://github.com/ParadigmMC/mcman/actions/workflows/build.yml) that build mcman.
**Stable Releases:**

These require you to be logged in to github.
| [Windows][latest-win] | [OSX/Linux][latest-linux] |
| :-------------------: | :-----------------------: |

Please note that these builds might not work completely.
- [Github Releases](https://github.com/ParadigmMC/mcman/releases)
- [build action](https://github.com/ParadigmMC/mcman/actions/workflows/build.yml) (requires github account)

## Recommended Usage

Expand Down Expand Up @@ -80,3 +78,37 @@ mcman build && cd server && start
## Usage with Docker

After initialization mcman also provides a default dockerfile for you, this dockerfile basically runs your server after running `mcman build`.

## Using configuration files

While running a minecraft server, 99% of the time you have to edit the configuration files of the server. **mcman** can actually help you with that.

Next to your `server.toml` file, you'll see a `config/` folder. It's actually pretty simple. **mcman** will copy files from `config/` to `server/` while building your server (after installing the server, plugins/mods/datapacks etc.)

Actually, mcman doesn't *just* copy the files. It has **variables** too - you can use variables inside your configuration files. This is very useful if you want to have something (like the server name) in multiple places - if you want to change it, you can just change the variable in `server.toml` (instead of manually going through every file that contains it)

> Note
> `config/server.properties` should already be present after mcman init, so pretend it doesn't exist for now
For an example, let's create a `server.properties` file in `config/` and fill it like so:

```properties
motd=${MESSAGE}
```

And add this to `server.toml`:

```toml
[variables]
MESSAGE = "Hello from server.toml!"
```

After you run `mcman build`, you can see that `server/server.properties` is like this:

```properties
motd=Hello from server.toml!
```

You can read more about [variables](./DOCS.md#variables) here.

**Tip:** You can 'pull' a config file from `server/` to `config/` with the [`mcman pull`](./DOCS.md#mcman-pull-file) command.
Loading

0 comments on commit f6b4390

Please sign in to comment.