Language

Battery Management

Battery Management

Modrinth

A plugin to inform about battery status, save energy after inactivity and inform about low / high battery charge.

25 downloads updated 8mo ago
latest v1.0-RELEASE Modrinth
Paper 1.20.1 – 1.20.1 ManagementTechnologyUtility

About

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.

Suggestions

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._.

Commands

  • /battery [ | ]

Requests and returns the current battery percentage, status, or both if no argument is specified.

Usage

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.

Configuration

Default plugin config:

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

Example scripts to start server and shutdown if plugin stopped server:

Linux

#!/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

Windows

@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

Versions

Release
1.0-RELEASE
paper · 1.20.1 · 8mo ago
* `/battery` command with status information * Automatic stop after inactivity (toggleable) * Warning at low / high battery percentage (toggleable)
25

Comments 0

No comments yet. Be the first to share your thoughts.

Download Battery Management

Files are served directly from the original source. Modgrid does not host or modify them.