ServerOptimizer is a high-performance plugin specifically designed for Endstone servers (Minecraft Bedrock Edition) to monitor performance in real-time and automatically implement critical optimization routines to maintain a solid 20.0 TPS (Ticks Per Second).
Featuring dynamic view distance adjustment, emergency crash recovery, and detailed performance reporting, this plugin is an essential tool for stabilizing and scaling your server.
- Real-time TPS Monitoring: Accurately tracks and records TPS values every second.
- Dynamic View Distance: Automatically adjusts the server's view distance based on live TPS to prevent lag spikes.
- Emergency Crash Recovery: Drastically reduces settings and runs aggressive cleanup when critical lag is detected (
TPS < 15.0). - Automatic Cleanup: Periodically performs memory management (Garbage Collection) and clears estimated unnecessary chunks and entities.
- Performance Display: Allows administrators to toggle a real-time TPS and player count popup display for specific players.
- An active Endstone server instance (version
0.10or higher). - Python 3.8+ for running the plugin and for developers wishing to build from source.
- Download: Download the latest release (the
.whlfile) from the assets. - Upload: Place the
.whlfile into your server'splugins/directory. - Restart/Reload: Restart your Endstone server or use the command
/reloadto load the plugin.
To ensure a clean and isolated build environment, use pipx to manage the build dependencies.
-
Install
pipx: If you don't have it, install the tool that runs Python applications in isolated environments.pip install pipx
-
Clone or Download: Obtain the source code for the plugin.
-
Build the Package: Use
pipxto run thebuildmodule, which will create the final distributable package (often a.whlor the source file itself).# This command uses pipx to run the 'build' tool to create the package pipx run build --wheel -
Deploy: Place the resulting plugin file (
ServerOptimizerPlugin.pyor the built package contents) into your server'splugins/directory.
| Command | Usage | Description | Permission | Default |
|---|---|---|---|---|
/tps |
/tps |
Check the current server TPS (Ticks Per Second). | serveropt.command.tps |
True (All players) |
/lag |
/lag |
View a simple lag/status report. | serveropt.command.lag |
True (All players) |
/optimize |
/optimize status |
View the detailed performance status (TPS, Health, View Distance). | serveropt.command.optimize |
OP |
/optimize full |
Manually run a full optimization (Chunk/Entity/Memory cleanup). | serveropt.command.optimize |
OP | |
/optimize view <player> |
Toggle the continuous performance display for a player. | serveropt.command.optimize |
OP | |
/viewdistance |
/vd [distance] |
Manually set the server's view distance (between 4 and 12). |
serveropt.command.viewdistance |
OP |
/vd auto |
Toggle the Dynamic View Distance feature (enabled by default). | serveropt.command.viewdistance |
OP |
The permission node serveropt.admin grants access to all administrative commands (/optimize and /viewdistance). This is automatically granted to OP players.
Since this is a single-file Python plugin, configuration is managed by editing the variables directly within the on_load method of the ServerOptimizerPlugin.py file.
Key variables you may wish to adjust in the on_load method:
| Variable | Default Value | Description |
|---|---|---|
self.auto_optimize |
True |
Master switch for all scheduled optimization routines. |
self.optimization_interval |
120 |
How often (in seconds) the full auto-optimization runs, regardless of TPS. |
self.base_view_distance |
8 |
The standard view distance for auto-adjustment. |
self.min_view_distance |
4 |
The lowest view distance the plugin will set during lag. |
self.max_view_distance |
12 |
The highest view distance the plugin will set when TPS is high. |
self.tps_critical |
15.0 |
TPS level that triggers the Emergency Crash Recovery. |
self.tps_warning |
18.0 |
TPS level that triggers the scheduled Auto-Optimization run. |
This plugin is designed to be easily extensible. If you wish to contribute to its development:
- Fork the repository.
- Implement new optimization routines (e.g., specific entity cleanup using Endstone API calls).
- Submit a Pull Request detailing your changes.
Note: The plugin maintains high compatibility by avoiding reliance on non-standard external Python libraries (like psutil). All core functionality relies on the standard Python library and the Endstone API.
This plugin was developed with assistance from Artificial Intelligence.
I served as the System Designer and Code Reviewer, meticulously verifying and debugging the code generated by the AI to ensure stability and performance.
I sincerely hope the community will join in improving this system, helping us make the Minecraft Bedrock Server experience even better for everyone.