Skip to content

SimplyYourAverageDev/safeserver

Repository files navigation

Safeserver

A simple Fabric mod for Minecraft that adds mandatory password authentication to your server, enhancing security.

Features

  • Password Protection: Players must set a password on their first join and log in on subsequent joins.
  • Interaction Blocking: Prevents unauthenticated players from breaking/placing blocks, using items/entities, or interacting with the world.
  • Command Restriction: Blocks all commands except /login and /setpassword until the player is authenticated.
  • Secure Storage: Passwords are securely hashed (SHA-256) and stored in a JSON file (config/safeserver/passwords.json).
  • OP Safety:
    • Temporarily removes OP status from players upon joining until they authenticate.
    • Removes OP status from players upon disconnecting as a safety measure.
    • Restores OP status after successful authentication if the player was originally OP.
  • Position Freeze & Safety: Players are placed in Spectator mode and teleported to a safe, fixed location (0, calculated surface Y, 0) upon joining if authentication is needed. They are kept at this location until authenticated, preventing coordinate leakage. Their original position is restored upon successful login.

Commands

  • /setpassword <password> <password>
    • Sets your initial password upon first joining the server.
    • Requires typing the password twice for confirmation.
    • Only usable when required (first join).
  • /login <password>
    • Logs you into the server with your existing password.
    • Only usable when required (subsequent joins).
  • /changepassword <oldPassword> <newPassword> <newPassword>
    • Allows an authenticated player to change their own password.
    • Requires the old password and confirmation of the new password.
  • /resetpassword <playerName>
    • OP Only (Level 2+): Resets the password for the specified player.
    • Forces the target player to set a new password using /setpassword on their next join (or immediately if they are currently online).

Installation

  1. Ensure you have Fabric Loader installed.
  2. Download the Safeserver JAR whose +mc<version> suffix exactly matches your server.
  3. Place the JAR file into your server's mods folder.
  4. Restart your server.

The mod will automatically generate the necessary configuration file upon first load.

Supported Minecraft Versions

Every stable Java Edition release after 1.20 is built and verified independently:

1.20.1 through 1.20.6, 1.21 through 1.21.11, and 26.1 through 26.2.

Each artifact targets one exact Minecraft version. For example, safeserver-2.1.3+mc1.20.1.jar is the 1.20.1 artifact. This avoids claiming binary compatibility across versions that have different server APIs.

Multi-Version Development

The repository uses Stonecutter with Mojang mappings. The files under src/ are the canonical 26.2 source; Stonecutter's //? conditions contain only the API differences required by older versions.

Build commands:

  • ./gradlew :26.2:build builds the active development target.
  • ./gradlew :1.20.1:build builds one older target.
  • ./gradlew buildAll builds all 22 supported targets.
  • ./gradlew collectArtifacts builds all targets and writes release and sources JARs to build/releases/<mod-version>/.

When adding a feature, implement it once in src/. If a Minecraft API differs, add the smallest possible Stonecutter condition and run ./gradlew collectArtifacts. CI runs this same aggregate build for every push and pull request, so a feature cannot be merged while any supported target fails to compile.

To add a future Minecraft release:

  1. Add the version to settings.gradle.kts.
  2. Add its pinned Fabric API version to stonecutter.properties.toml.
  3. Add compatibility conditions only where the new Minecraft API requires them.
  4. Run ./gradlew collectArtifacts before committing.

Publishing to Modrinth

Publishing creates one Modrinth release containing the version-qualified JARs for every supported Minecraft release. Modrinth applies compatibility metadata to the release as a whole, so choose the file whose +mc<version> suffix exactly matches your server.

Local dry run:

printf '%s\n' 'Release notes' > .release-changelog.md
./gradlew collectArtifacts
scripts/publish_modrinth.sh --changelog-file .release-changelog.md --dry-run

Local release:

export MODRINTH_TOKEN=your_token_here
./gradlew collectArtifacts
scripts/publish_modrinth.sh --changelog-file .release-changelog.md

For GitHub Actions, add a MODRINTH_TOKEN repository secret with Modrinth version read/create/write/delete permissions. Set mod.version in stonecutter.properties.toml, push a matching tag such as v2.1.3, and .github/workflows/release-modrinth.yml will build and publish one release containing all targets. Republishing the same mod version safely replaces its existing combined or per-Minecraft releases.

About

A minecraft mod to secure cracked servers

Resources

Stars

5 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors