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.
  • Minestrapper has only been tested on modern versions of Minecraft. However, the estimated minimum version that this should work is Java Edition 1.7.2

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.4.tar.gz (14.3 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.4-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: minestrapper-0.3.4.tar.gz
  • Upload date:
  • Size: 14.3 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.4.tar.gz
Algorithm Hash digest
SHA256 b74b589729e76d1a388a90eddddc9265d3c80853653fb4cbb5269c30974a500e
MD5 52757f4ed49e15fced214bec18fbeb84
BLAKE2b-256 7704dd04a34f65235ff9911cdd83164f2243c421b6862450e538ffbcd265205a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: minestrapper-0.3.4-py3-none-any.whl
  • Upload date:
  • Size: 16.5 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 7687bab8e59795bb87caf99c90462fd703093ad7a93b200c90b6c9dc8a7d30c6
MD5 dc2ac2c3e042bcdd8536f5e5337055db
BLAKE2b-256 8d2b89abfafe182f07bee1772e0244242453c18a8639763cf9996455dbb5246b

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