A simple Fabric mod for Minecraft that adds mandatory password authentication to your server, enhancing security.
- 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
/loginand/setpassworduntil 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.
/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
/setpasswordon their next join (or immediately if they are currently online).
- Ensure you have Fabric Loader for Minecraft
26.1.2installed. - Download the
Safeservermod JAR file. - Place the JAR file into your server's
modsfolder. - Restart your server.
The mod will automatically generate the necessary configuration file upon first load.
Use scripts/publish_modrinth.sh to build and publish a new version to Modrinth automatically.
- Create a Modrinth PAT with
VERSION_CREATEscope. - Export it in your shell:
export MODRINTH_TOKEN=your_token_here - Run one of:
- Publish current
mod_versionfromgradle.properties:scripts/publish_modrinth.sh --changelog-text "Bug fixes and improvements" - Bump version and publish:
scripts/publish_modrinth.sh --version 2.1.1 --set-version --changelog-file CHANGELOG.md
- Publish current
Useful flags:
--game-versions "26.1.2"to override targeted MC versions--loaders "fabric"to set loaders--sources-jar build/libs/safeserver-2.1.1-sources.jarto override detected sources jar--version-type release|beta|alpha--status listed|unlisted|draft|archived--featured true|false--skip-buildif you already built the jar
Defaults:
- Project:
safeserver - API:
https://api.modrinth.com/v2 - Loader:
fabric - Game version: read from
gradle.properties(minecraft_version) - Uploads both main and sources jars in the same Modrinth version
This repo now includes .github/workflows/release-modrinth.yml.
Setup:
- Add repository secret
MODRINTH_TOKEN(PAT withVERSION_CREATEscope). - Keep
gradle.propertiesmod_versionin sync with your release tag.
Release flow:
- Commit your release changes (including
mod_versionbump). - Create and push a tag matching the version:
git tag v2.1.1git push origin v2.1.1 - Workflow builds and publishes to Modrinth automatically.