
A plugin to inform about battery status, save energy after inactivity and inform about low / high battery charge.
Minecraft Paper Plugin to save energy after inactivity and inform about low / high battery charge. This is thought for
small local servers that are running on old laptops or other devices with a battery. It (currently) has no permission set on it's command(s), which means everyone
is able to see the battery status.
If you have any suggestions, found a bug or have a feature request, please feel free to contact me!
The plugin is currently also only available for 1.20.1 on paper, but write me a DM and I can make it available for your desired version.
My discord username is eneas._.
Requests and returns the current battery percentage, status, or both if no argument is specified.
The plugin can be configured to check the battery every given amount of minutes, and broadcast a warning in the chat if
the battery is below a specified threshold and discharging or above another specified threshold and charging (default
low is 10% and high is 90%).
It also has a feature to stop the server after a given duration of inactivity. This works by testing if no players are online and that the last player left and the last console command was executed, before this duration.
If enabled, it also creates a marker file at a given path, so that the server start-script can test if the file exist and trigger further actions, like completely shutting down the device.
battery:
enabled: true # Disable battery checks if set to false
warning_thresholds:
high: 90 # Warn if battery is above this percentage
low: 10 # Warn if battery is below this percentage
check_interval: "5m" # How often to check battery level
inactivity:
enabled: true # Disable auto-shutdown if set to false
max_duration: "15m" # Max inactivity time before shutdown
check_interval: "5m" # How often to check for inactivity
shutdown_info:
file: "/tmp/battery_management/shutdown.info" # File indicating a shutdown request
#!/bin/bash
java -Xms2G -Xmx2G -XX:+UseG1GC -jar /Path/to/paper-server.jar --nogui
FILE="/tmp/battery_management/shutdown.info"
if [ -f "$FILE" ]; then
rm -f "$FILE"
shutdown now
fi
@echo off
setlocal
java -Xms2G -Xmx2G -XX:+UseG1GC -jar C:\Path\to\paper-server.jar --nogui
set "file=C:\Windows\Temp\battery_management\shutdown.info"
IF EXIST "%file%" (
del "%file%"
shutdown -s -t 0
)
endlocal