Repository navigation
4.0.0c
General Improvements & Cosmetic Adjustments
- Added POSIX-compliant shebang (
#!/usr/bin/env python3) for Linux/macOS.
Windows safely ignores this line as a comment. - Reformatted ASCII banner using
textwrap.dedent()to correct indentation,
remove blank lines, and ensure consistent alignment across terminals. - Standardized console output formatting with consistent prefixes, spacing, and
section headers. Enhances both interactive readability and log clarity. - Cleaned up inline comments and docstrings for better developer clarity.
- Interactive mode build lists now display in ascending order, with the newest
build appearing last at the bottom of the screen.
Connectivity & Network Checks
- Windows retains default
ping -nbehavior. - Linux/Unix: switched to
ping -cfor POSIX compliance. - If
pingis unavailable on Linux/Unix, the script falls back to a TCP socket
test to confirm connectivity. - If both methods fail, the script now prints:
“Internet connection could not be established.”
and exits instead of raising a traceback.
File Handling & Installation Process
- Windows:
- Continues using delete+copy (
shutil.copyfile) for updates, compatible with
Windows file locking. - If the target JAR is in use (e.g., Minecraft server still running), the script
prints a clear error and exits instead of silently failing. - User is instructed to stop the server before applying updates.
- Continues using delete+copy (
- Linux/Unix:
- Uses atomic staged replacement (
os.replace) to avoid partial/corrupt writes. - Removed redundant copy step following replace.
- Uses atomic staged replacement (
- Unified user experience: console output remains the same across both platforms,
even though underlying methods differ.
User-Agent Compliance (API V3 Requirement)
- Added new option
-ua / --user-agentto specify a custom User-Agent string
when making API requests. - Per PaperMC API v3 documentation, a valid User-Agent must:
- Clearly identify the software.
- Include a contact method (URL or email).
- Not be generic (defaults like curl/wget are rejected).
- Examples:
--user-agent PaperUpdater/3.0.1c (github.com/creeper36)-ua PaperUpdater-creeper@email.com
- If no User-Agent is provided, the script defaults to:
PaperMC-Update/VERSION (https://github.com/Creeper36/PaperMC-Update)
(where VERSION is this script’s version number). - Warning: The default may be blocked at any time by PaperMC. It is strongly
recommended that users configure a custom User-Agent.
Batch Mode & Errorlevel Support
-
New flag:
-ba / --batch- Produces log-friendly output.
- Disables download animations and extra blank lines.
- Filters out cosmetic messages intended only for interactive use.
- Suitable for redirecting (
>>) into logs.
-
Example:
python C:\Minecraft\Scripts\server_updater.py --batch C:\Minecraft\paper.jar >> C:\Minecraft\logs\latest.log -
Errorlevels introduced for batch scripting integration:
- 0 → Normal exit: New Minecraft version found.
- 1 → Normal exit: No new version found.
- 2 → Error: No internet connection detected.
-
Example batch usage:
PYTHON server_update.py C:\Minecraft\paper.jar IF %ERRORLEVEL% EQU 2 GOTO ERRORINTERNET IF %ERRORLEVEL% EQU 1 GOTO SAMEPAPER IF %ERRORLEVEL% EQU 0 GOTO NEWPAPERFOUND GOTO SAMEPAPER -
Allows batch scripts to make branching decisions based on updater results.
Interactive Mode Enhancements
-
Builds list sorted ascending → newest at the bottom.
-
Overhauled argument/file naming logic with well-defined rules.
-
Disabled
--no-configand--config-filewhen in interactive mode (not relevant). -
Explicit errors now shown instead of silent failures for bad arguments.
-
Interactive Mode File Handling Rules:
-
Example:
python c:\minecraft\server_update.py --interactive c:\minecraft\paper.jarScenario Result
--interactivewith no last argument Createspaper-[version]-[build].jarin server_updater.py script directory
--interactive c:\minecraft(directory path) Createspaper-[version]-[build].jarinside c:\minecraft
--interactive c:\minecraft\paper.jar(new file) Creates a new c:\minecraft\paper.jar
--interactive c:\minecraft\paper.jar(not in use) Overwrites the existing c:\minecraft\paper.jar
--interactive c:\minecraft\paper.jar(in use) Attempt delete → fails → prints ERROR and exits script. If Linux/Unix: will overwrite and stage till reboot
Configuration File Handling
- Version history stored in
version_history.json. - If not found in the working directory, the script searches the parent directory
automatically as a fallback. - Ensures smooth upgrades without requiring explicit
--config-fileflags. - In interactive mode,
--no-configand--config-fileare intentionally disabled
since version history is irrelevant to manual update selection.
Other Adjustments
- Reorganized argparse into clearer groups (Version Options, File Options, General Options).
- Cleaned up deprecated arguments while preserving stubs for backwards compatibility.
- Verified
--batchproduces minimal, log-friendly output (no banners, no fluff). - Added structured error exits to prevent running after unrecoverable failures.
- Expanded inline comments explaining Windows vs Linux behaviors for maintainers.