Skip to main content

Minestrapper is a bootstrapper for Minecraft servers that lets you easily add custom features to your server without needing a full mod/plugin loader.

Project description

Minestrapper

A bootstrapper for Minecraft Java Edition Servers

About

Rather than building full Java plugins or mods, this project lets you tap into the server’s state and other lifecycle events, and add custom functionality directly in Python.

That means small features can be added without the overhead of a mod loader (e.g. Fabric, Forge) or plugin loader (e.g. Paper, Spigot), while keeping the server in its vanilla form.

[!NOTE] Feel free to still use your favorite mods or plugins alongside it if you want! Minestrapper mainly serves for smaller, simpler features.

Current Features

  • Config Handling
    • Contains a class for managing configuration files of both Minestrapper and Minecraft.
    • Minestrapper config uses a file named Config.json in a /minestrapper directory relative to the root of the Minecraft Server.
    • Allows for direct editing of server.properties.
  • State Handling
    • Contains a class for getting the current state of the server based on the server output.
    • Tracks the following states: STARTING, RUNNING, PAUSED, STOPPING, STOPPED.
  • Periodic Callbacks
    • A lifecycle function that runs every 20ms.
    • Used for things that need to happen constantly.
    • Mainly isn't used in preference of lifecycle events.
  • New Line Callbacks
    • A lifecycle function that runs everytime a new line is sent from the Minecraft Server process
  • Logger
    • Prints out stuff both from forwarding logs from the Minecraft process and also custom logs from Minestrapper.
    • Keeps Minestrapper specific logs visually consistent with Minecraft Server logs (e.g. "[19:48:06] [Minestrapper/INFO]: Initialized Minestrapper Logger successfully")
    • Logs to a file named latest-minestrapper.log and then replaces the vanilla latest.log with it when the server stops.
    • Provides transformers to modify each logged line to the output as needed.
  • Built-in features:
    • "State Styles"
      • Updates the terminal title and text color based on the server's current state.
      • Makes it easier to see whether the server is starting, running, paused, stopping, or stopped.
    • "Server Resource Pack"
      • Includes a lightweight HTTP server for serving a server resource pack.
      • Removes the need for an external hosting site for the pack.
      • Keeps resource pack delivery self-contained within the server setup.

Potential Future Features

  • Backups: Let the owner integrate save backups everytime the server closes locally. It can either be done locally only, with cloud services, or even both.
  • Remote Panels: Allow the owner along with anyone else authorized to remotely turn on and off the server. Only the owner will be able to view logs and run commands however.
  • Custom Commands: Add your own admin commands that can trigger multiple Minecraft commands or even run Python code.

Installation Guide

  1. Install Python at https://www.python.org/ (>=3.1).
  2. Go to your Minecraft Server directory.
  3. Make a directory exactly named minestrapper and change directory to it.
mkdir minestrapper && cd minestrapper
  1. Make a new Python environment.

Windows:

python -m venv .venv

MacOS / Linux:

python3 -m venv .venv
  1. Activate the environment.

Windows:

.\.venv\Scripts\activate

MacOS / Linux:

source .venv/bin/activate
  1. Install the minestrapper package.
pip install minestrapper
  1. Create a file exactly named Config.json and edit to your liking.
{
  "$schema": "https://faizaan-j.github.io/mine-strapper/schemas/Config.schema.json"
}

[!NOTE] The schema will help you fill out the file so it's recommended to use some kind of app that can read JSON schemas to edit the file easier. There are numerous required fields that you must fill out.

  1. Make an entry point file inside the minestrapper directory.

Example:

from pathlib import Path

from minestrapper import Server

if __name__ == "__main__":
    server = Server(path=Path.cwd().parent)
    server.start_server()

    server.wait_loop()

Important Notes

  • You still need to do any necessary port forwarding yourself.

License

MineStrapper is released under the MIT License.
Feel free to use, modify, and share.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

minestrapper-0.3.3.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

minestrapper-0.3.3-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file minestrapper-0.3.3.tar.gz.

File metadata

  • Download URL: minestrapper-0.3.3.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for minestrapper-0.3.3.tar.gz
Algorithm Hash digest
SHA256 0efe2a3e50ceccc4cf93da70621a4def65a50050dd4db7d9d5ac163f03a851e9
MD5 48c685a9e05915c570e94dc1e98339c0
BLAKE2b-256 34039ef0cb55145fe1a2fa700d29d189a23b74a2f174b2b20db8e0d0695e4056

See more details on using hashes here.

File details

Details for the file minestrapper-0.3.3-py3-none-any.whl.

File metadata

  • Download URL: minestrapper-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.8

File hashes

Hashes for minestrapper-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 b72b8ab974f405f7ca324109c53b86412ca7e798783d10b24c935c10c9e7ba30
MD5 ceadd126815bc582e9687c7af757218b
BLAKE2b-256 ae3c60e6693b750ec82379c5390371434d83e3c0a8f68c503b4057a9922a36e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page